How does the Entity Framework Track objects?

1

I have read a number of such questions, but I find my very specific question: How does the entity framework "track" objects? That is, as when loading an object and even without sending the object back to the context class, just calling contexto.SaveChanges() , does it already save the changes automatically? How is this object "followed" by the entity framework? Is it some kind of return by reference and such?

    
asked by anonymous 06.03.2018 / 15:54

1 answer

1

When you read a database object, the Entity Framework maps the property by property and it sets a state ( states ) for each property, so it knows any changes that occur with the object.

There is still proxy , this proxy replaces some properties virtual entities to insert hooks to perform actions automatically when the property is accessed.

Any changes you make to the object without the Entity Framework knowing, should do the attach of the object so that the Entity Framework can map it.

    
06.03.2018 / 16:20