I'm hoping I can get some clarification on what the best practices are for using a
dbcontext with tracking disabled. What are the implications on setting the
context.Configuration.ProxyCreationEnabled to false?
As I understand it, this will effectively disable tracking on entities, but what if I then need to
SaveChanges with this context? I think I remember seeing a way to get the context to track a specific entity manually, but I am unable to find more information on that. What are the performance implications for calling
SaveChanges on a context that has proxy creation disabled?
I also have similar concerns with using no-tracking queries as well. Is it possible to
SaveChanges after retrieving data with
Without ProxyCreationEnabled, EF will not eagerly load child entities for your object without explicitly "Including" them and change tracking will be disabled as well.
If you use AsNoTracking, you will have to set the entities states to Modified on the object context in order to persist changes. You can do that with code like this:
context.Entry(entity).State = EntityState.Modified;
Here are a couple of other SO questions that go deeper into your question.