What difference does .AsNoTracking() make?

Technology CommunityCategory: Entity FrameworkWhat difference does .AsNoTracking() make?
VietMX Staff asked 3 years ago

Entity Framework exposes a number of performance tuning options to help you optimise the performance of your applications. One of these tuning options is .AsNoTracking(). This optimisation allows you to tell Entity Framework not to track the results of a query. This means that Entity Framework performs no additional processing or storage of the entities which are returned by the query. However, it also means that you can’t update these entities without reattaching them to the tracking graph. So there are significant performance gains to be had by using AsNoTracking.