-
-
Notifications
You must be signed in to change notification settings - Fork 163
Added AsNoTracking for readonly queries #136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LindaLawton Yes, It avoids the overhead of setting up change tracking for each entity instance. See https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.entityframeworkqueryableextensions.asnotracking?view=efcore-2.0 |
This is fine, assuming no one is using these classes and relying on this behavior (which would be weird). Do you think there will still be a performance improvement given that the dbcontexts are registered as scoped and some of these methods are hit multiple times? I'm wondering if there's a perf decrease for developers not using the store caching. |
@scottbrady91 Note from https://docs.microsoft.com/en-us/ef/core/querying/tracking:
|
@neyromant very smart i hadnt seen this before. I will be adding it to a few projects. |
I have prepared some simple benchmarks for AsNoTracking (https://github.com/neyromant/Benchmarks/blob/master/Benchmarks/AsNoTracking/AsNoTrackingTests.cs) using BenchmarkDotNet (https://github.com/dotnet/BenchmarkDotNet) Here is the results:
|
Since we reorganized our repos, I did this change manually. We're tracking here for the release notes: IdentityServer/IdentityServer4#2518. Thanks! |
So, I will not be on the list of contributors? Well, all right. |
Sorry -- if we hadn't reorganized the repos, then you would have. |
No description provided.