Is it worth to use AsNoTracking in dbset?
I found this:
In my opinion it doesn't look correct. What do you think?
5 Replies
you can just do:
and then when you need them to be tracking you can do
_db.Functions.AsTracking()
no need to have two different dbcontexts or anything like thatdidn't know about that! thanks
Or you just call AsNoTracking() on the query itself, instead of changing the defaults.
If you
.Select()
into DTOs — as you should — that alone disables tracking
and if you're fetching something without projecting it, that means you're doing some fetch-update-save or fetch-delete-save pattern
Where you do want trackingInteresting, did not know that.