无法创建“”类型的常量值。此上下文仅支持基元类型或枚举类型。
多个集合,其中有一个集合是List类型,那么List第一要放在主表,否则会报这个错误
/// <summary> /// 获取子角色列表 /// </summary> /// <param name="parentRoleId">父角色ID</param> /// <returns></returns> public List<RoleFunction> GetSubRoleList(int parentRoleId) { var items = _lotteryServiceContext.RoleFunctions.Where(m => m.ParentRoleId == parentRoleId).ToList(); List <RoleFunction> roleFunctionList = new List<RoleFunction>(); while (items.Count > 0) { roleFunctionList.AddRange(items); items = (from a in items //List要作为主表 join b in _lotteryServiceContext.RoleFunctions on a.RoleId equals b.ParentRoleId select b).ToList(); } return roleFunctionList; }

浙公网安备 33010602011771号