Reputation: 75
I have seen that in some systems, relationships are mapped in Entity Framework without being mapped in the SQL tables. What is the point of using Entity Framework to map relationships over mapping them in SQL?
Upvotes: 0
Views: 220
Reputation: 5986
First, If you use Entity framework in large system, it will reduce much code.
Second, we don't need to concern about how to connect to database.
Third,Entity framework can be used as infrastructure for data services and OData services.
Upvotes: 1
Reputation: 1586
Real answer? No good reason unless you need them in the app, and you don't control the database, and it doesn't have them.
Generally, instead of that, it's a developer who's assuming that "the app does that" in terms of relationships, and also assumes that no other app or process will ever touch that data.
Here's a blog post on the latter: https://blog.greglow.com/2016/05/31/should-my-database-have-foreign-key-constraints/
Upvotes: 1