我想让所有用户获得特定角色。我在下面写了一下查询。但它给了我转换错误。
List<Expression<Func<AspNetUsers, object>>> include = new List<Expression<Func<AspNetUsers, object>>>();
Expression<Func<AspNetUsers, object>> roleInclude = (roles) => roles.AspNetRoles;
include.Add(roleInclude);
string roleName="Admin";
var users = Repository<AspNetUsers>.GetEntityListForQuery(r=>r.AspNetRoles.Where(y=>y.Name == roleName),null,include);
如何写这些where子句?
在语法本身中,它给出了以下错误:
无法将类型System.Collections.Generic.IEnumerable {AspNetUser}隐式转换为bool
如何为另一个实体编写where子句?