Is there any way to analyze what entities have been loaded during one query request? Currently I'm using lazy loading and it has huge performance impact. So I would want to analyze query somehow and .Include all related objects.
You can handle ObjectMaterialized
event of your context.
ObjectContext.ObjectMaterialized
PS. If you work with DbContext
, you need to retrieve ObjectContext
from it first:
var context = new YourDbContext();
var adapter = (IObjectContextAdapter)context;
var objectContext = adapter.ObjectContext;