Base solution for your next web application
Open Closed

add cutom global data filter,ABP have method ,how to add on zero. #6589


User avatar
0
vyungadmin created

ABP document is :

protected override void OnModelCreating(DbModelBuilder modelBuilder) 
{
   base.OnModelCreating(modelBuilder);
   modelBuilder.Filter("PersonFilter", (IHasPerson entity, int personId) => entity.PersonId == personId, 0 );
}

but on zero PortalDbContext class , method OnModelCreating the parms type not   DbModelBuilder, it is ModelBuilder. as follows:

protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); ... }

How can I add cutom global data filter?


3 Answer(s)
  • User Avatar
    1
    maliming created
    Support Team

    What is product framework type (.net framework or .net core)?

  • User Avatar
    1
    ryancyq created
    Support Team

    Hi, currently the documentation for data filter is only provide example for enitity framework not ef core.

    For ef core, you can take a look at https://aspnetboilerplate.com/Pages/Documents/Articles\How-To\add-custom-data-filter-ef-core

  • User Avatar
    0
    vyungadmin created

    @maliming @ryancyq .net framework4.6.1