Open Closed

How can I use AsNoTracking for some queries ? #6396


User avatar
1
user5.abpio created

According repository guide, I try to close entity tracking but it doesn't work as below as you can see. By the way, I don't want to close the whole repository or class, I just want to close some queries.

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.4.2
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

5 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ,

    can you check this once https://learn.microsoft.com/en-us/ef/core/querying/tracking

    https://www.appsloveworld.com/entity-framework-core/100/7/abp-framework-misses-irepository-asnotracking-or-cannot-use-select-where?expand_article=1

    Thanks,

  • User Avatar
    0
    user5.abpio created

    Hello Anjali_Musmade;

    Firtstly, I appropriate for your answer. But I know how to use it in EF Core and it doesn't seem in abp.io repository classes, so my question is how can I use it in abp repository queries. As you can see in the picture below, Queryable object has not AsNoTracking() feature.

  • User Avatar
    0
    nlachmuthDev created

    Hello,

    i would sugggest you to update to abp 8.0. There has been a lot of improvements how to work with NoTracking using the abp repositories.

    Checkout the blog post for 8.0: https://blog.abp.io/abp/announcing-abp-8-0-release-candidate IReadonlyRepository now defaultly use EfCores NoTracking feature.

    Kind regards Nico

  • User Avatar
    0
    user5.abpio created

    Thanks for your suggestion. It is a big deal to update to abp for us for now. I must convice many people for it. If there is a solution for 7.4.x, I would like to hear it.

  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    Firtstly, I appropriate for your answer. But I know how to use it in EF Core and it doesn't seem in abp.io repository classes, so my question is how can I use it in abp repository queries. As you can see in the picture below, Queryable object has not AsNoTracking() feature.

    Hi, you can add Volo.Abp.EntityFrameworkCore package to the Domain project.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09