What does EntityFramework's proxy mean?

.net c# entity-framework orm proxy

Question

In my projects, I've utilized EntityFramework as an ORM, and I have no issues utilizing this technology. I've heard that EntityFramework builds proxies. What proxy does this ORM produce, specifically? What does it do? When does EF produce it, too? What does the term "proxy," which is commonly used in ORM themes, really mean?

1
18
1/2/2019 3:53:42 AM

Accepted Answer

In the realm of ORM, a proxy is a type that is automatically created and inherits from your domain object type. The proxy represents an instance that just has access to its own ID and has not yet been filled with data from the database. The proxy subclass handles the load from the database whenever a property that is mapped to the database is accessed, making the load invisible to the client code.

When a relationship attribute between two entities is slowly loaded, proxies are often generated. For instance, if you access theuser.Address attribute, an Address proxy object is really what is returned. Once you have accessed one of the object's properties (such asuser.Address.StreetName ) will cause the Address object itself to load.

30
8/25/2011 11:24:42 AM



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow