有人能告诉我如何归还IQueryable<T>
吗?
我得到了:
无法将
System.Linq.IQueryable<object>
类型隐式转换为System.Linq.IQueryable<TType>
。存在显式转换(是 你错过了一个演员?)
提前谢谢
代码:
public IQueryable<TType> ExecuteScript<TType>(string script, object parameters) where TType : class, new()
{
string typeName = String.Empty;
LuaScript lScript = LuaScript.Prepare(script);
var lLScript = lScript.Load(Context.Server());
//Converts returned result into a string array.
var result = (string[])lLScript.Evaluate(Context.Database(), parameters);
if (result.Any())
{
_dataValue = new SortedDictionary<string, string>();
int i=0;
while(i < result.Count())
{
_dataValue.Add(result[i], result[i+=1]);
i++;
}
}
IQueryable<object> query = _dataValue.AsQueryable().Select(r => r.Value);
return query;
}
答案 0 :(得分:0)
您尝试从{
}返回IQueryable<object>
IQueryable<object> query = _dataValue.AsQueryable().Select(r => r.Value);
return query;
但函数返回类型是IQueryable<TType>
来自:
public IQueryable<TType> ExecuteScript<TType>(string script, object parameters) where TType : class, new()
尝试:
IQueryable<TType> query = _dataValue.AsQueryable().Select(r => r.Value);
return query;