Skip to content
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

Client side GroupBy is not supported. #22743

Closed
ajcvickers opened this issue Sep 24, 2020 · 1 comment
Closed

Client side GroupBy is not supported. #22743

ajcvickers opened this issue Sep 24, 2020 · 1 comment

Comments

@ajcvickers
Copy link
Member

Moved from discussion #22239.

Question

From @karnik1110

i am trying to perform groupby() on northwind using linq

using(var ctx = new TempContext())
{
    var customer = (from s in ctx.Customers
                    group s by s.LastName into custByLN
                    select custByLN);
    foreach(var val in customer)
    {
        Console.WriteLine(val.Key);
        {
            foreach(var element in val)
            {
                Console.WriteLine(element.LastName);
            }
        }
    }
}

it has the following exception
System.InvalidOperationException: 'Client side GroupBy is not supported.'

refrence to tutorial page refered
https://www.entityframeworktutorial.net/querying-entity-graph-in-entity-framework.aspx

Replies

From @smitpatel

See #19929
As the error message says, it is not supported. Since GroupBy is going to get all data of Customers table on client side anyway, you can use AsEnumerable to fetch whole table and apply GroupBy on client side yourself.

From @AndriySvyryd

@smitpatel We should add that to the message

From @smitpatel

Filed #22266

@smitpatel
Copy link
Member

Duplicate of #19929

@smitpatel smitpatel marked this as a duplicate of #19929 Sep 25, 2020
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants