You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At my .NET 2.2. application, I have a table named Operation mapped to a class.
It has a query:
varexportHash=(fromiin context.Operation
where i.DeleteDate ==null&& exportTypeList.Contains(i.Type)&& i.Status == OperationStatus.Code.Completed
&& i.ParentOperationID !=null&& operationIDList.Contains(i.ParentOperationID.Value)
orderby i.ProcessDate descending
group i by i.ParentOperationID into gselectnew{ ID = g.Key, List = g.ToList()}).ToDictionary(i => i.ID,i => i.List);
On 2.2 this query works but on 3.0.0-rc1, it gives an exception:
System.InvalidOperationException: 'The LINQ expression 'ToList<Operation>(GroupByShaperExpression:
KeySelector: o.ParentOperationID,
ElementSelector:EntityShaperExpression:
EntityType: Operation
ValueBufferExpression:
ProjectionBindingExpression: EmptyProjectionMember
IsNullable: False
)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync().
I am not sure why the grouping fails.
Operation class is quite simple:
[Table("Operation")]publicclassOperation{[Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)][Column("OperationID")]publicintID{get;set;}[Column("OperationTypeID")]public OperationType.Code Type {get;set;}[Column("OperationStatusID")]public OperationStatus.Code Status {get;set;}[Column]publicint?ParentOperationID{get;set;}[Column]publicDateTime?DeleteDate{get;set;}[Column]publicDateTimePlanDate{get;set;}[Column]publicDateTime?ProcessDate{get;set;}[Column]publicint?PeriodID{get;set;}}
Further technical details
EF Core version: 3.0.0-rc1.19456.14
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.3 Preview 4
The text was updated successfully, but these errors were encountered:
The GroupBy may be simple but it does not correspond to a SQL Group By. You are doing grouping.ToList(). That requires client side group by operator to generate groupings.
At my .NET 2.2. application, I have a table named Operation mapped to a class.
It has a query:
On 2.2 this query works but on 3.0.0-rc1, it gives an exception:
I am not sure why the grouping fails.
Operation class is quite simple:
Further technical details
EF Core version: 3.0.0-rc1.19456.14
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.3 Preview 4
The text was updated successfully, but these errors were encountered: