So in EF6, one could disable proxy creation like so:
this.Configuration.ProxyCreationEnabled = false;
From what I could find, the configuration scheme under EF7 has changed, but I cannot find anything on how to do so. I went through https://docs.efproject.net/en/latest/miscellaneous/configuring-dbcontext.html and even analyzed the DbContextOptionsBuilder object, but cannot find anything on it.
Am I going about ti the wrong way or is there something im missing? Thanks in advance.
When creating instances of POCO entity types, Entity Framework often creates instances of a dynamically generated derived type that acts as a proxy for the entity. This proxy overrides some virtual properties of the entity to insert hooks for performing actions automatically when the property is accessed.
EF Core change tracking works best when the same DbContext instance is used to both query for entities and update them by calling SaveChanges. This is because EF Core automatically tracks the state of queried entities and then detects any changes made to these entities when SaveChanges is called.
ProxyCreationEnabled is set to true , child objects will be loaded automatically, and DbContext. Configuration. LazyLoadingEnabled value will control when child objects are loaded.
EF7 EF Core 1.0 does not do proxy creation, so accordingly, there is no configuration option for this. See https://github.com/aspnet/EntityFramework/issues/997
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With