var query = _db.Mst_Users
.Where(item => item.CustomerUserId == customerUserId)
.Traverse(item => _db.Mst_Users.Where(parent => item.CustomerUserId == parent.ParentId))
.Select(item =>Convert.ToString(item.CustomerUserId)).ToArray();
在上面的查询中,我得到customerUserId
了一个数组中的 s:
int[] ids = query;
从上面的 int 数组:
var getgroup = from item in _db.Mst_Group
where ids.Contains(item.CustomerUserId)
select item;
但是,它显示以下错误:
int[] does not contain a definition for Contains and the best extension method overload system.linq.iqueryable.contains<tsource>