public static IQueryable BindActions(bool IsMemberId, int MemberId, string objectid, string compamyName)
{
var q = from a in QHW.Operator.Utils.ProcessScript.OrderActions.Elements("item")
where a.Element("actionGroupId").Value == "0" ||
QHW.Operator.Utils.ContextUtils.CurrentUser.ManagerGroupIdList.Exists(m =>
a.Element("actionGroupId").Value.Split(",".ToCharArray(),StringSplitOptions.RemoveEmptyEntries)
.Contains(m.ToString()))
select new
{
actionName = a.Element("actionName").Value,
actionFunction = a.Element("actionFunction").Value
.Replace("$ObjectId$", IsMemberId ? MemberId.ToString() : objectid).Replace("$CompanyName$", compamyName),
actionDescription = a.Element("actionDescription").Value,
actionGroupId = a.Element("actionGroupId").Value
};
return (IQueryable)q;
}无法将类型为“WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,<>f__AnonymousType0`4[System.String,System.String,System.String,System.String]]”的对象强制转换为类型“System.Linq.IQueryable”。
{
var q = from a in QHW.Operator.Utils.ProcessScript.OrderActions.Elements("item")
where a.Element("actionGroupId").Value == "0" ||
QHW.Operator.Utils.ContextUtils.CurrentUser.ManagerGroupIdList.Exists(m =>
a.Element("actionGroupId").Value.Split(",".ToCharArray(),StringSplitOptions.RemoveEmptyEntries)
.Contains(m.ToString()))
select new
{
actionName = a.Element("actionName").Value,
actionFunction = a.Element("actionFunction").Value
.Replace("$ObjectId$", IsMemberId ? MemberId.ToString() : objectid).Replace("$CompanyName$", compamyName),
actionDescription = a.Element("actionDescription").Value,
actionGroupId = a.Element("actionGroupId").Value
};
return (IQueryable)q;
}无法将类型为“WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,<>f__AnonymousType0`4[System.String,System.String,System.String,System.String]]”的对象强制转换为类型“System.Linq.IQueryable”。
不能这样做,q是匿名类型,你可以声明一个类
return q.AsQueryable();