问题将LINQ Core 2.2迁移到Core 3.1

时间:2020-01-14 23:03:24

标签: c# entity-framework linq .net-core

我尝试将核心项目从2.2迁移到3.1,但是我的LINQ无法正常工作。

tmpIQueryable = db.Data
.Where(c => Channels.Contains(c.channelid) && c.enddate > DateTime.Now.Date 
&& c.startdate < untildate)
.Include(c => c.Channel)
.OrderBy(c => c.channelid)
.OrderBy(c => c.startdate)
.GroupBy(p => p.channelid)
.SelectMany(g => g.OrderBy(p => p.startdate).Take(2000))
.ToList();

我收到错误消息:

"System.InvalidOperationException: 'Processing of the LINQ expression 'g => g
    .OrderBy(p => p.startdate)
    .AsQueryable()
    .Take(2000)' by 'NavigationExpandingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core."

我该如何解决?为什么EntityFramework 3不能像以前一样工作:(

谢谢 拉尔夫

0 个答案:

没有答案