Base solution for your next web application
Open Closed

How to disable Data Filters for whole service or module? #2206


User avatar
0
pradippatil created

Hi,

Can we disable data filters for whole service or module? If yes, how? I need this because I have to disable MayHaveTenant filter at many places.

Thanks


6 Answer(s)
  • User Avatar
    0
    pradippatil created

    Does anyone has answer for this?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Sory for the late response. This is not possible currenty, you have to manually disable it on unitOfWork.

  • User Avatar
    0
    pradippatil created

    Hi,

    Is it a good idea to disable tenant filters globally in the DbContext itself?

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                base.OnModelCreating(modelBuilder);
    
                modelBuilder.DisableFilterGlobally(AbpDataFilters.MayHaveTenant);
                modelBuilder.DisableFilterGlobally(AbpDataFilters.MustHaveTenant);
            }
    

    I have disabled filters globally using above code in DbContext class, but MayHaveTenant filter is still enabled. Any idea why DisableFilterGlobally not working?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Please check this issue <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1752">https://github.com/aspnetboilerplate/as ... ssues/1752</a>

  • User Avatar
    0
    pradippatil created

    Hi,

    I have tried to add below code in EntityFramework and Web project module classe's PreInitiliaze method: In which module's PreInitialize method we need to add below code?

    Configuration.UnitOfWork.OverrideFilter(AbpDataFilters.MayHaveTenant, false);
                Configuration.UnitOfWork.OverrideFilter(AbpDataFilters.MustHaveTenant, false);
    

    But still only MayHaveTenant filter got disabled and MustHaveTenant filter was still enabled.

    What I am missing here?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    I have reopned this issue <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1752">https://github.com/aspnetboilerplate/as ... ssues/1752</a>. We can continue there.