As of 2.0 multiple HasQueryFilter() calls on EntityTypeBuilder result in only the latest one being used. It would be nice if multiple query filters could be defined this way.
Example:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<MyEntity>()
.HasQueryFilter(e => e.IsDeleted == isDeleted)
.HasQueryFilter(e => e.TenantId == tenantId);
}
// In application code
myDbContext.Set<MyEntity>().ToList() // executed query only has the tenantId filter.
Current workaround is to define all filters in single expression, or rewrite the expression to concat multiple filters.
As of 2.0 multiple
HasQueryFilter()calls onEntityTypeBuilderresult in only the latest one being used. It would be nice if multiple query filters could be defined this way.Example:
Current workaround is to define all filters in single expression, or rewrite the expression to concat multiple filters.