© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
8 replies
G1lles

Entity Framework Foreign Key

What is better? Declaring your foreign keys in your model and declaring it in your modelbuilder (.hasForeignKey) or doing it by only declaring the relationship in your modelbuilder?
image.png
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

Foreign Key | Entity Framework
C#CC# / help
2y ago
Entity Framework Foreign Key restraint
C#CC# / help
16mo ago
Entity Framework Core 8 -Foreign Key Constraint failure.
C#CC# / help
2y ago
❔ Entity Framework not required foreign key as required?
C#CC# / help
3y ago