0

I am trying to build application that shows all the relations between tables

one-to-one//

many-to-one //

manyto many

does there is an option to get the relation between two entities via EntityFramwrok for any exisiting database ?

Thanks

2 Answers2

1

In Entity framework, you can create a .edmx file from an existing database. After creating edmx, you will get a model showing relationship between all the entities.

Follow the steps as given in this link-

Entity Framework Database First

bxc00zzy
  • 104
  • 2
  • 14
0

If you need to retrieve to retrieve relationships from a generic database (of a third party application) creating an edmx on the fly, probably is not the best option.

The best way to retrieve relationships is to use system tables.
The only issue is that you won't be able to understand many to many relationships because in R-DBMS you have to use a junction table to map them (you can use an algorithm to immagine if a table is a junction table but you can't be sure). By the way, you have the same issue using EF. If you think that this could be a solution you can have a look here Know relationships between all the tables of database in SQL Server to see the query in SQL Server.

Community
  • 1
  • 1
bubi
  • 6,414
  • 3
  • 28
  • 45