Open Closed

Disable DataFilter from HttpApi #5680


User avatar
0
andmattia created
  • ABP Framework version: v7.1.0

I've a case where I have api the host need to access to orders (all tenant) and tenat user only own data.

I know that is possible to do that in appliaction/domain but I need to add logic to all calls. My idea is create a second HttpApi and disable datafilter but it doesn't work.

I create a using with UnitOfOwrk and inside of this using a second using disable a data fitler for multitenant but on application service I see tha same GIUD fot unit off work but IMultitenat filtert have filter with IsEnable set to true.

Is it possibile disable filter on HttpApi and propagate to Application/Domain/EF?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

4 Answer(s)
  • User Avatar
    0
    andmattia created

    Hi

    I follow the documentation but it doesn't work.

           public class MyBookService : AbpController
        {
            private readonly IDataFilter<IMultiTenant> _softDeleteFilter;
            private readonly IRepository<Book, Guid> _bookRepository;
    
            public MyBookService(
                IDataFilter<IMultiTenant> softDeleteFilter,
                IRepository<Book, Guid> bookRepository)
            {
                _softDeleteFilter = softDeleteFilter;
                _bookRepository = bookRepository;
            }
            
            [HttpGet]
            public async Task<List<Book>> GetAllBooksIncludingDeletedAsync()
            {
                //Temporary disable the IMultiTenantfilter
                using (_softDeleteFilter.Disable())
                {
                    return await _bookRepository.GetListAsync();
                }
            }
        }
    

    In my application class IMultiTenant is Enable but on HttpApi is disable

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi

    we have the following implementation which abp follows https://docs.abp.io/en/abp/latest/Best-Practices/Module-Architecture

    Create you controller in HttpApi.csproj Project implement and inject you ApplicationService .

    Create **ApplicationService ** in Application.csproj

    Create interface of the application service in Application.Shared.csproj

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    andmattia created

    Are you try this code in 7.1.0?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi,

    Yes, can you share you Controller code and application service code?. i see that you have Abpcontroller extended by ApplicationService Class.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.