我正在尝试获取保存在缓存中的数据。但它会在“选择新的 FilterSsrsLog”行中引发异常。例外:只能从 LINQ to Entities 调用此函数
List<ExecutionLog3> reportServerDB = UpdateCache();
var reportLog = (from r in reportServerDB
orderby r.TimeStart descending
where ((model.reportName == null ? true : r.ItemPath.Contains(model.reportName)) &&
(model.reportFolder == null ? true : r.ItemPath.Contains(model.reportFolder)) &&
(r.TimeStart >= startDateTime) &&
(r.TimeStart <= endDateTime)
)
select new FilterSsrsLog
{
UserName = r.UserName,
ReportName = r.ItemPath,
ReportFolder = r.ItemPath,
Format = r.Format,
Parameters = r.Parameters,
TimeStart = r.TimeStart,
TimeEnd = r.TimeEnd,
TotalTime = EntityFunctions.DiffMilliseconds(r.TimeStart, r.TimeEnd)
});
如果我删除“select new FilterSsrsLog”代码块并编写“select r”,它就可以工作。但我只需要那些列,所以我能做些什么来解决这个问题?