Reputation: 2302
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 recognize Id as Pk it selfs?
And Contact property as foreign reference for ContractId?:
public int ContractId { get; set; }
public virtual Contract Contract { get; set; }
Upvotes: 2
Views: 1775
Reputation: 22555
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
Upvotes: 3