EF 6 IsRequired() allowing empty strings

后端 未结 3 745
面向向阳花
面向向阳花 2021-02-12 17:14

In past projects with versions of EF5 and EF4, the IsRequired() fluent API method would thrown a DbEntityValidationException if the property was null or an empty string. In my

3条回答
  •  借酒劲吻你
    2021-02-12 18:11

    These days you can still use [Required] attribute and have configurable AllowEmptyStrings

    [Required(AllowEmptyStrings = false)]
    

    False is default

提交回复
热议问题