EF 支持的完整注释列表为:
- KeyAttribute:主键,默认情况下还定义为 Identity
- StringLengthAttribute
- MaxLengthAttribute
- ConcurrencyCheckAttribute
- RequiredAttribute:Required 注释告诉 EF 某一个特定属性是必需的
- TimestampAttribute
- ComplexTypeAttribute
- ColumnAttribute
- TableAttribute
- InversePropertyAttribute
- ForeignKeyAttribute:表示关系中用作外键的属性。注释在外键属性。属性导航可能会放置和指定关联导航属性名称或者放置并指定与外键名称。
- DatabaseGeneratedAttribute:指定数据库生成属性值的方式
- NotMappedAttribute:表示应从数据库映射中排除属性或类
具体参考:https://msdn.microsoft.com/zh-cn/data/jj591583