© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
4 replies
Gopher

Does AsNoTracking improve Performance in this Case?

 public async Task<ItemDto?> GetAsync(int id)
        {
            return await Context.Items.AsNoTracking().Select(i => new ItemDto()
            {
                Id = i.Id,
                Name = i.Name
            }).FirstOrDefaultAsync(i => i.Id == id);
        }
 public async Task<ItemDto?> GetAsync(int id)
        {
            return await Context.Items.AsNoTracking().Select(i => new ItemDto()
            {
                Id = i.Id,
                Name = i.Name
            }).FirstOrDefaultAsync(i => i.Id == id);
        }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Error in AsNoTracking()
C#CC# / help
4y ago
❔ Is there a way to improve this code Performance ?
C#CC# / help
4y ago
Is it worth to use AsNoTracking in dbset?
C#CC# / help
3y ago