0
- 我有一個名爲Query的類。
- 我呼喚權限
- 查詢一類具有權限
- 的收藏我需要查詢用戶具有權限的查詢。
但我不知道如何使where子句。複雜EF查詢返回基礎對象,但過濾子對象
public class Query
{
public int QueryId { get; set; }
public string QueryName { get; set; }
public string QuerySql { get; set; }
public string CreatedBy { get; set; }
public string QueryType { get; set; }
public string Column1 { get; set; }
public string Operator1 { get; set; }
public string Value1 { get; set; }
public string Connector2 { get; set; }
public string Column2 { get; set; }
public string Operator2 { get; set; }
public string Value2 { get; set; }
public string Connector3 { get; set; }
public string Column3 { get; set; }
public string Operator3 { get; set; }
public string Value3 { get; set; }
public virtual ICollection<Permission> Permissions { get; set; }
}
public class Permission
{
public int PermissionId { get; set; }
public string UserName { get; set; }
}
public IQueryable<Query> GetQueriesForUser(string userName)
{
_context.Queries.Where(m=>m.Permissions.Contains(???))
}