Mixing Fluent API and DataAnnotations in EF code first

后端 未结 3 1625
北恋
北恋 2020-11-29 10:20

While we mostly use fluent configuration for our code-first POCOs, we have found it useful to use data annotations for things like the table name, PKs, etc. since it makes i

3条回答
  •  情歌与酒
    2020-11-29 11:11

    You can use Data Annotation attributes and Fluent API at the same time. Entity Framework gives precedence to Fluent API over Data Annotations attributes.

提交回复
热议问题