繁体   English   中英

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

[英]Execution of 'System.Linq.Enumerable:GroupBy(IEnumerable`1,Func`2)' on the database server side currently not implemented

我收到错误

目前尚未在数据库服务器端执行'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()

然后,其余查询。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM