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?
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();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With