EF 4.3.1 - code first automatic migrations - how to specify column width
I am trying to find examples or documentation related to DbMigration and ColumnModel. I just want to specify the row width in DBMigration Up method For example.
AddColumn("Districts", "Code", c => c.String());
will create nvarchar (max) - and I want to specify maxlength (20) for example. Is it integrated with EntityTypeConfiguration or should I add manually as well
this.Property(t => t.Name).HasColumnName("Code").IsRequired().HasMaxLength(20);
The MSDN Help does not provide any examples and the step-by-step tutorial on the ef4 blog only covers the basics
+3
source to share
2 answers