I have two expression, for example:
public Expression<Func<Entity, bool>> EntityFilterForRead
{
    get
    {
        if (User.Roles.Contains(IdentityRole.ADMIN))
        {
            return _ => true;
        }
        return _ => false;
    }
}
    
public Expression<Func<AnotherEntity, bool>> AnotherEntityFilterForRead
{
    get
    {
        if ( ... )
        {
            return _ => true;
        }
        return _ => false;
    }
}
And we have one more expression where we need these two expressions, because ThirdEntity has Entity and AnotherEntity and we included them.
public Expression<Func<ThirdEntity, bool>> FilterForRead
{
    get
    {
        return //Combine two expressions...
        //ThirdEntity have --> ThirdEntity.Entity and ThirdEntity.AnotherEntity
        //and we should return EntityFilterForRead && AnotherEntityFilterForRead
    }
}
I get this exception:
The LINQ expression ... could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information."
I read the whole page and tried everything, but it is not working. Does anybody have a suggestion?
These solutions are not working for me.
The difference is I have different entities.
 
    