-
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
Using Max( ) is not working after upgrading from 2.2 to 3.1. #20240
Comments
Update: I guess this is not about Max(). I changed my query like this and the exception is not changed. var groupRates = GetPastRatesAsGroupByCodeId(businessDate);
return groupRates
.SelectMany(t => t.Where(s => s.Date == DateTime.Now))
.ProjectToType<ExchangeCodeDto>()
.GetPagedAsync(page, size); groupRates comes from the following method. So this issue is about GroupBy or SelectMany ? private IQueryable<IGrouping<Guid, ExchangeRate>> GetPastRatesAsGroupByCodeId(DateTime businessDate)
{
var query = QueryAsNoTracking().Where(s => s.Date < businessDate);
return query.GroupBy(g => g.ExchangeCode.Id);
} |
Any thoughts or workaround ? @ajcvickers @smitpatel |
QueryAsNoTracking().Where(s => s.Date < businessDate).OrderBy(g => g.ExchangeCode.Id).Where(t => t.Date == DateTime.Now).ProjectToType<ExchangeCodeDto>().GetPagedAsync(page, size); |
Ok, as it seems this is duplication of #17068 so i am closing. |
Using Max() is not working after upgrading from 2.2 to 3.1.
The Excption and code :
Further technical details
EF Core version:
Database provider: (e.g. Npgsql.EntityFrameworkCore.PostgreSQL)
Target framework: (e.g. .NET Core 3.1.2)
IDE: (e.g. VS Code)
The text was updated successfully, but these errors were encountered: