0
comment
comment
on 8/17/2015 11:26 AM
In Code First Entity Framework models, you can define the length of a string field with StringLengthAttribute, but you have to write code in OnModelCreating to indicate a CHAR/NCHAR fixed length field:
public class MyEntity
{
[Key]
public int Id { get; set; }
[StringLength(2)]
public string FixedLengthColumn { get; set; }
}
public partial class MyContext : DbContext
{
public virtual DbSet MyEntities { [...]