Where is MergeOption in Entity Framework 6?

c# entity-framework

Question

I'm used to Entity Framework 4, where, when calling certain views I had to be sure to set MergeOption to NoTracking like so

SHEntity.qry_UserPermissions.MergeOption = System.Data.Objects.MergeOption.NoTracking;

But in updating to EF 6.1 I don't even see MergeOption as part of qry_UserPermissions anymore. I have to set this or EF will sometimes combine records when I don't want it to. I've googled around and haven't had any luck, even though it seems like a simple issue to me.

How do I turn off tracking in EF 6.1?

1
17
5/25/2014 6:14:28 AM

Accepted Answer

using AsNotrack() method entity, you may stop tracking of entity in EF this can be written we you querying on context.

Example.

using (SHEntity context = new SHEntity())
{
   var up = context.qry_UserPermissions.AsNoTracking().ToList();
}
18
3/24/2015 12:28:15 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow