开发者

Are attributes like Key, ForeignKey etc required in EF CF?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜