C
C#13mo ago
WowoRoo

❔ Entity framework migration problem

I have problem with creating the migration. I get this error "The seed entity for entity type 'Author' with the key value 'Id:1' cannot be added because it has the navigation 'Country' set. To seed relationships, add the entity seed to 'Author' and specify the foreign key values {'CountryId'}." I still get this error even with I think all entities connected in right way. I add link to pastebin, because code is too long. https://pastebin.com/sxePEFLW
Pastebin
// Authorusing System.ComponentModel.DataAnnotations;using System.C...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
2 Replies
WowoRoo
WowoRooOP13mo ago
Found answer, I was assigining Country inside Author class into new Country. After deleting initialization it started to work
Accord
Accord13mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server