Код: Выделить всё
public class Permissions
{
public int InformationId { get; set; }
public bool View { get; set; }
public bool ViewSecret{ get; set; }
}
Код: Выделить всё
var result = _dbContext.Information
.Where(workingQueryFilter)
.Select(x => new Information
{
Name = x.Name
ChildInformation = x.ChildInformation
.AsQueryable()
.Where(notWorkingQueryFilter).ToList()
});
Код: Выделить всё
var workingQueryFilter = Filter(ListOfPermissions);
public static string Filter(List
permission)
{
var expression = "i => i.IsDeleted == false"
for (var i = 0; i < permission.Count; i++)
{
expression += $"i.InformationId == {permission[i].InformationId} && {information[i].View}"
}
return expression;
}
Однако, когда мы хотим отфильтровать ChildInformation, я получаю следующее сообщение об ошибке:
Выражение типа 'System.Collections.Generic.List
Код: Выделить всё
1[Models.ChildInformation]' cannot be used for parameter of type 'System.Linq.IQueryableКод: Выделить всё
1[Models.ChildInformation] Where[ChildInformation](System.Linq.IQueryableПодробнее здесь: https://stackoverflow.com/questions/782 ... ot-working