AsNoTracking() has been around in Entity Framework for a while. Its ideal to use when pulling back a collection of items which won’t be updated (a listing page for example) as it gives a little performance boost in these cases.
The default behaviour for AsNoTracking() is not to perform identity resolution. This means if your query returns 4 books and their authors, you’ll get 8 instances in total even if 2 books have the same author.
In Entity Framework Core 5.0 you can use AsNoTrackingWithIdentityResolution() to not track entities but still perform identity resolution so you won’t have duplicate instances.
The usage is the same as AsNoTracking()…
To enable identity resolution with no tracking queries EF Core uses a mini or stand-alone change tracker in the background which goes out of scope and is garbage collected as soon as the query results have been materialized.
Note… AsNoTrackingWithIdentityResolution() is a little slower than AsNoTracking() but still quicker than regular queries which utilize full change tracking.