我收到错误
目前未在数据库服务器端执行“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。
有什么解决方案或解决方法吗?