How do I set a column in SQL Server to varchar(max) using ASP.net EF Codefirst Data Annotations?

前端 未结 5 885
南笙
南笙 2021-02-06 20:31

I\'ve been searching around the web trying to figure out the right syntax to have Entity Framework Code First create my table with a column: varchar(max).

This is what I

5条回答
  •  日久生厌
    2021-02-06 21:28

    [Column(TypeName = "varchar(MAX)")]
    

    Surprisingly the most obvious solution works.

    The [MaxLength] attribute only creates a varchar column with a max length that isn't MAX but - in my case (SQL Server Express 2008 R2) - 8000.

提交回复
热议问题