-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for GroupBy entityType #17653
Comments
GroupBy entityType cannot be server translated to SQL GROUP BY directly. |
But same code works on ef core 2.x |
It evaluated that on client side. |
Ok I Got it, but i think it can be translated to
Can you consider implement this? |
It is invalid SQL |
Seems like it works on Sqlite. Fails on SqlServer. We will investigate more in which database supports and make a decision. Thanks for pointing to that. |
thank you |
Pulling over some thoughts from another issue: Group by supports grouping on scalars and anonymous types. It should also support grouping on an entity type. This should behave the same way as grouping on an anonymous type with the same columns that the entity type has. This can be translated to SQL by grouping on all columns of that entity type. Alternatively, grouping can be performed on the primary key columns and all other columns can be re-created through These translation forms should be possible for all RDBMSes. This is a LINQ to SQL migration hurdle. |
Looking at some ef6 generated queries, it seems like we put all columns inside Group by clause. That could be one implementation (may not be most ideal) |
Update by @smitpatel
Certain databases support projecting columns after SQL GROUP BY which are neither contained in aggregate nor in grouping key. (SqlServer disallows this). This means that GroupBy entity type when aggregate is applied can be translated to server by grouping by PK and then projecting all the columns for materialization.
Original post:
An InvalidOperationException is throwed when GroupBy on then Include property. But same code works on ef core 2.X.
Current version:
EF Core version: 3.0.0-preview9.19423.6
The text was updated successfully, but these errors were encountered: