I am trying to run a tracking request for my objects so that I can update them out of context. However, when no tracking does not work, and I get an exception indicating
"The ObjectContext instance has been deleted and can no longer be used for operations that require a connection."
This exception is thrown using a property which, in terms of the database model, is a foreign key for a separate table, do I need to somehow set notracking for this separate object?
My code is:
List<EmailQueue> result = null;
using (Entities context = new Entities())
{
var emailQueueQuery = context.EmailQueues;
emailQueueQuery.MergeOption = System.Data.Objects.MergeOption.NoTracking;
result = emailQueueQuery.Execute(System.Data.Objects.MergeOption.NoTracking).ToList<EmailQueue>();
}
return result;
source
share