In Code first The INSERT statement conflicted with the FOREIGN KEY constraint

后端 未结 2 1197
鱼传尺愫
鱼传尺愫 2021-01-21 01:15

I just started using Code first approach for creating databases. I have following 3 tables :

public partial class AccountHolder
{
    public int AccountHolderId          


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-21 02:10

    You try to insert Address Nominees_NomineeId that is not exists in Nominee.You should First instance of Nominee then fill value and create Address and fill value last create instance of AccountHolder.and then save

提交回复
热议问题