Entity Framework CodeFirst many to many relationship with additional information

前端 未结 2 1906
無奈伤痛
無奈伤痛 2020-12-02 18:50

I have the following model :

class Contract
{
   string ContractID{get;set;}
   ICollection Parts{get;set;}
}

class Part
{
   string PartID{get;         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 19:35

    Perhaps a better way to do is this answer? Create code first, many to many, with additional fields in association table

    It doesn't require fluent APIs and also sets up the PK on join table.

提交回复
热议问题