在当前未实现的数据库服务器端执行'System.Linq.Enumerable:GroupBy(IEnumerable`1,Func`2)'

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在当前未实现的数据库服务器端执行'System.Linq.Enumerable:GroupBy(IEnumerable`1,Func`2)'相关的知识,希望对你有一定的参考价值。

我收到了错误

在当前未实现的数据库服务器端执行'System.Linq.Enumerable:GroupBy(IEnumerable`1,Func`2)'。

当我执行以下查询时

from t in dbContext.TrackerRecords
   where t.DeviceSerial.Value.Equals(deviceSerial) &&
   t.Date.Value >= fromDate && t.Date.Value <= toDate
   orderby t.Date.Value descending
   group t by t.Date.Value.Date into g
   select new TripDataModel
   {
      Day = g.Key,
      Trips = (from x in g
         group x by x.Date.Value.Hour into gj
         where gj.Max(m => m.Speed.Value) > 0
         let AvgSpd = gj.Average(m => m.Speed.Value)
         select new TripModel
         {
            MinSpeed = gj.Min(m => m.Speed.Value),
            MaxSpeed = gj.Max(m => m.Speed.Value),
            AvgSpeed = AvgSpd > 0 
                ? Math.Round(AvgSpd, 2, MidpointRounding.AwayFromZero) 
                : 0,
            FromHour = new DateTime(g.Key.Year, g.Key.Month, g.Key.Day, gj.Key, 0, 0)
         })
   }

我在linqtosql中尝试了查询并且工作正常,但我需要使用Telerik OpenAccess。

这有什么解决方案或解决方法吗?

答案

http://www.telerik.com/forums/server-side-currently-not-implemented

在第一次查询之后,将其转换为列表,然后运行子查询。

像这样:

from t in dbContext.TrackerRecords.ToList()

然后,您的其余查询。

以上是关于在当前未实现的数据库服务器端执行'System.Linq.Enumerable:GroupBy(IEnumerable`1,Func`2)'的主要内容,如果未能解决你的问题,请参考以下文章

用户 'XP-xxxxxxx\ASPNET' 登录失败。 说明: 执行当前 Web 请求期间,出现未处理的异常。请 检查堆栈跟踪信

DELPHI当前提供程序不支持从单一执行返回多个记录集

“/”应用程序中的服务器错误。

FMS 服务器端代码未执行

前后端分离Shiro未执行授权方法解决办法

java socket实现服务端,客户端简单网络通信。Chat