I want to have an understanding of how Entity Framework uses Proxy classes? Why Entity Framework needs Proxy classes? What actually happens behind the scenes when Lazy loading is Enabled?
It's a decorator that adds lazy loading capabilities to an entity object by -
The proxy inherits from the entity class. Therefore, the navigation properties must be virtual
and the entity class can't be sealed
.
Maybe the most instructive way of understanding them is by seeing what it takes to implement lazy loading without proxies.