Reputation: 10838
I have specified a text field's MaxLength
as 4096 with EF fluent api in order to limit its length:
this.Property(p => p.MyText).HasMaxLength(4096).IsRequired();
But for some reason in SQL Server, the column becomes nvarchar (max)
.
Just for test if I specify 2048 to make sure that SQL Server gets updated
this.Property(p => p.MyText).HasMaxLength(2048).IsRequired();
And this way it is works.
So my queston why EF sets sql nvarchar (max)
when MaxLength(4096)
Upvotes: 7
Views: 9525