-
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
Lots of select operation in group by when entity has OwnsOne configuration #14028
Comments
This happens because each aggregate operator contains nav expansion due to relinq structure. var sum = db.Fees.Select(x => new { x, x.ShareCroppingMoney })
.GroupBy(x => 1)
.Select(x => new
{
//Money = x.Sum(s => s.Money),
City = x.Sum(s => s.ShareCroppingMoney.City),
Company = x.Sum(s => s.ShareCroppingMoney.Company),
District = x.Sum(s => s.ShareCroppingMoney.District),
Industry = x.Sum(s => s.ShareCroppingMoney.Industry),
Nation = x.Sum(s => s.ShareCroppingMoney.Nation),
Province = x.Sum(s => s.ShareCroppingMoney.Province),
TaxServiceCharge = x.Sum(s => s.ShareCroppingMoney.TaxServiceCharge)
}).ToList(); |
Further, if you are just applying aggregate operator over var sum = db.Fees
.GroupBy(x => 1, x => x.ShareCroppingMoney )
.Select(x => new
{
//Money = x.Sum(s => s.Money),
City = x.Sum(s => s.City),
Company = x.Sum(s => s.Company),
District = x.Sum(s => s.District),
Industry = x.Sum(s => s.Industry),
Nation = x.Sum(s => s.Nation),
Province = x.Sum(s => s.Province),
TaxServiceCharge = x.Sum(s => s.TaxServiceCharge)
}).ToList(); |
I try to use this, and here is the sql:
It looks like Sum in MEMORY |
I try this too, and there are more select query. |
Hello,
I use group by query with OnwnsOne Entity, which like this:
Then, query like this:
And you will see lot of select:

How can I resolve this problem? Is that a bug?
The text was updated successfully, but these errors were encountered: