You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the problem with the global filter.
I have the code modelBuilder.Entity<Report>().HasQueryFilter(TenantDataFilter);
and function
public Expression<Func<Report, bool>> TenantDataFilter
{
get
{
var expr = IsModerated.HasValue ?
(Expression<Func<Report, bool>>)(x => !x.IsDeleted && x.IsModerated == IsModerated) :
(Expression<Func<Report, bool>>)(x => !x.IsDeleted);
return expr;
}
}
How do you do call every query?Do I want to change IsModerated variable in the request?
Exception message:
Stack trace:
### Steps to reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
```c#
Console.WriteLine("Hello World!");
Further technical details
EF Core version: (found in project.csproj or packages.config)
Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Operating system:
IDE: (e.g. Visual Studio 2015)
The text was updated successfully, but these errors were encountered:
@sergeu90 The correct way to do this is to write a single expression that handles both cases. This is because the filter itself is part of the model, which is only built once and cached. For example:
This works by capturing the closure variable IsModified from the context so that each time the query is evaluated it will take the current value of IsModified from the context.
Describe what is not working as expected.
I have the problem with the global filter.
I have the code
modelBuilder.Entity<Report>().HasQueryFilter(TenantDataFilter);
and function
How do you do call every query?Do I want to change IsModerated variable in the request?
Exception message:
Stack trace:
Further technical details
EF Core version: (found in project.csproj or packages.config)
Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Operating system:
IDE: (e.g. Visual Studio 2015)
The text was updated successfully, but these errors were encountered: