Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is entity graph in Entity Framework?

I have been looking into some Entity framework tutorials and I have come across the word Entity Graph. I haven't got a clear idea about this term and its use. Can anyone provide info on this topic like what it is and its use in the context of entity framework?

like image 500
geothachankary Avatar asked Oct 19 '22 07:10

geothachankary


1 Answers

When instantiated objects are joined together in a relationship they are referred to as a graph, or an entity graph. The Entity Framework has some important rules about how graphs are maintained.

Example, if you have a User(Entity) graph that consists of a User with Roles, Features.

  • When you detach the User

  • The User will be disconnected from this graph and the releationship references (Graph edges) will be destroyed.

  • You cannot travel from User to Roles/Features, because the graph edges (releationships) are destroyed.

I recommend you buy the "Programming Entity Framework DbContext" book (author: EF-Queen Julia Lerman) and you will find there a good explanation:

http://shop.oreilly.com/product/0636920022237.do

like image 119
Bassam Alugili Avatar answered Oct 21 '22 23:10

Bassam Alugili