© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
Capping Deer

❔ 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.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Entity Framework migration
C#CC# / help
4y ago
❔ Entity Framework Migration Issues
C#CC# / help
3y ago
Entity Framework Migration Creation
C#CC# / help
4y ago
Entity framework
C#CC# / help
14mo ago