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

Can't translated set.GroupBy(x=>x.Time.Year) #29345

Closed
Cricle opened this issue Oct 13, 2022 · 3 comments
Closed

Can't translated set.GroupBy(x=>x.Time.Year) #29345

Cricle opened this issue Oct 13, 2022 · 3 comments

Comments

@Cricle
Copy link

Cricle commented Oct 13, 2022

File a bug

Include your code

 set.GroupBy(x=>x.Time.Year).ToQueryString()

Include stack traces

No

Include verbose output

System.InvalidOperationException:“The LINQ expression 'DbSet<TestData>()
    .GroupBy(x => x.Time.Year)' 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 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.”

Include provider and version information

EF Core version:
Database provider: (Microsoft.EntityFrameworkCore.Sqlite)
Target framework: (.NET 6.0)
Operating system:
IDE: (e.g. Visual Studio 2022 17.3.3)

@ajcvickers
Copy link
Member

@Cricle What is the type of the Time property?

@Cricle
Copy link
Author

Cricle commented Oct 14, 2022

@Cricle What is the type of the Time property?

DateTime type

EF Core Version is 6.0.4/6.0.10

@ajcvickers
Copy link
Member

Duplicate of #19929.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 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