score:2
although ef core 2.1 introduced improvements to linq groupby translation, the implementation is still far from perfect and produces exceptions in many scenarios due to invalid sql generation. your scenario is just one of them and is not working even with the recent at this time ef core 2.1.1 bits.
the first thing you should do is to submit it to the ef core issue tracker, so they know and fix it when possible.
the problem seems to be related to the key property aliasing (it also doesn't work if you use the "normal" .groupby(e => e.typeid).orderby(g => g.key)
). the current workaround i've found is to use anonymous type key having the same property name(s) as the source(s):
_context.mytable
.groupby(e => new { e.typeid })
.orderby(g => g.key.typeid)
.select(g => g.count())
Source: stackoverflow.com
Related Query
- GroupBy OrderBy Linq - invalid column
- LINQ Lambda efficiency of code groupby orderby
- LINQ Source Code Available
- multiple orderby in this linq code
- linq after groupby unable to get column values
- Linq Lambda GroupBy and OrderBy
- why Linq GroupBy After OrderBy dismissed order operation?
- LINQ GroupBy then OrderBy Behaviour
- LINQ - sub query using OrderBy and GroupBy
- Linq - OrderBy int column gives incorrect results
- LINQ to SQL: Invalid column name 'DepartureGate', even though the column exists
- creating Linq to sqlite dbml from DbLinq source code
- LINQ Error Invalid Column Name on Group by sum
- How to perform LINQ OrderBy based on a stringname for column
- Linq query giving Invalid column name "xyz" error
- Linq to Entity Groupby and concatinate column
- MVC LINQ dynamic orderBy getting column type
- GroupBy DateTime column with offset C# Linq
- how to groupby on only one column using linq
- Getting 'Data source is an invalid type' when binding Linq query to Gridview
- LINQ Query Exception error Invalid column name 'courseId1' EFCore
- GroupBy and OrderBy in LINQ
- LINQ (Dynamic): OrderBy within a GroupBy using dynamic linq?
- Asp.net LINQ groupby and orderBy on dates does not retrieve the expected output
- Invalid column name. The name was never implemented in the code
- LINQ GroupBy and then OrderBy a property from the previous query
- source code for LINQ 101 samples
- LINQ GroupBy for multiple Column
- Linq GroupBy Max and add column
- LINQ Groupby query on a single column
More Query from same tag
- construct expression tree in run time
- Create list of class from list of numbers using Linq
- How to get the closest number from a List<int> with LINQ?
- Object reference not set to an instance of an object list to a list using linq
- Check if object exists in a VB.NET dictionary using Primary Key
- C# Lambda Expression for Unique Record for string in list of List
- linq to xml with C# and VS2008
- Using pivot table in linq
- Extension method with optional generic argument
- Use reflection to make dynamic LINQ statements in C#
- Inner Join on Entity Framework
- How to get key value based on id from list of dictionaries?
- how to write this into linq to object query?
- Linq Query Suggestion
- Custom LINQ Method into a store expression for re-usability and scaling later
- Parse csv or excel file in Silverlight
- Can't access multiple nested objest in linq query
- Linq with String Array Contains
- Linq FirstOrDefault with nulllable operator
- Enhance this LINQ query for readability and performance?
- linq to sql + update table
- Use data from Gridview 1 to populate Gridview 2
- Hierarchical queries in LINQ
- How to Execute a method inside LINQ to Entities'
- How do I Filter LINQ query by date?
- How to sort multiple list properties?
- Convert SQL to linQ Group By having count and sum
- What is the best way to insert Bulk Xml (XElement) data to Sql server Table using C#?
- LINQ Any an array to predicate an array whether it consists of the text of the first array
- Why does this additional join increase # of queries?