The child/dependent side could not be determined for the one-to-one relationship

后端 未结 1 1151
一向
一向 2021-02-13 17:15

I am trying to update my database with \"update-database\" command in package manager console, But I have this kind of error:

The child/dependent side could not          


        
1条回答
  •  眼角桃花
    2021-02-13 18:06

    You have to put the below code in your DBContext class, not in SnapShot class. Don’t modify the Snapshot class, it’s auto generated class.

    modelBuilder.Entity()
                .HasOne(a => a.CapitalCity)
                .WithOne(a => a.Country)
                .HasForeignKey(c => c.CountryID);
    

    0 讨论(0)
提交回复
热议问题