If we use common naming conventions for objects and properties in EF code first approach, do we need to decorate properties by Key, ForeignKey etc. attributes?
Does EF rec开发者_开发知识库ognize Id as Pk it selfs?
And Contact property as foreign reference for ContractId?:
public int ContractId { get; set; }
public virtual Contract Contract { get; set; }
You do not need to decorate properties in EF if you follow the conventions outlined in this post from the ADO.NET Team Blog on Conventions for Code First
精彩评论