Skip to content

This package provides a set of extensions that allows adding multiple query filters on a same entity.

License

Notifications You must be signed in to change notification settings

HerveZu/EntityFramework.Extensions.AddQueryFilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EFCoreAddQueryFilter

EF Core only supports .HasQueryFilter which overwrites the previous filter per entity. Furthermore, it only supports query filters assigned to a concrete entity type.

This package provides a set of extensions that allows adding multiple query filters.

Usages

Add a query filter on a specific entity

public void Configure(EntityTypeBuilder<MyEntity> builder)
{
    modelBuilder.AddQueryFilter(x => x.IsVisible);
}

Add a query filter on multiple entities.

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.AddQueryFilterOnAllEntities<ISoftDeletable>(x => !x.IsDeleted);
}

About

This package provides a set of extensions that allows adding multiple query filters on a same entity.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages