What is the advantage of mapping relationships in Entity Framework without mapping in the table

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

Answers (2)

Jack J Jun- MSFT
Jack J Jun- MSFT

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

Greg Low
Greg Low

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

Related Questions