News

Adding a [FixedLength] Attribute in Code-First Entity Framework

Author: Craig Stuntz 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…
Read more