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;