无法创建“”类型的常量值。此上下文仅支持基元类型或枚举类型。

多个集合,其中有一个集合是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;
        }

 

posted @ 2017-12-28 19:14  花生打代码会头痛  阅读(187)  评论(0)    收藏  举报