We are migrating an asp.net application to CodeFirst
(we used .net 3.5
and EF
). In our code, we had:
this.myObjectContext.myTable.MergeOption = MergeOption.NoTracking
I want to achieve the same thing using CodeFirst
. If I use
this.myObjectContext.myTable.AsNoTracking()
this returns a new query where the entities returned will not be cached in the DbContext
or ObjectContext
, but this means that everywhere I want to use this table in my page with NoTracking
, I will have to add AsNoTracking()
, while when setting the merge option, I had to do this only once in my page.
Is there a way to achieve this using .net 4.5.2
, EF 6
and CodeFirst
?