You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft.AspNetCore.OData 9.x - 9.2.1 used in investigation
Microsoft.AspNetCore.OData 8.x - 8.2.7 used in investigation
Microsoft.AspNetCore.OData 7.x - 7.7.8 used in investigation
Describe the bug
EntitySet aggregation DOES NOT work as expected for object collections but works as expected for Ef Core database provider (InMemory and SqlServer).
Visit here to familiarize with entity set aggregation implementation
Visit here to find a test for entityset aggregation
Reproduce steps
To demonstrate how the issue can be repro'ed, let's define a simple OData service that works with both Ef Core InMemory database provider and object collections as data sources
What you'll above from the above responses is that the OrdersTotal for customer Sue is the aggregated total of 300 in the case of Ef Core - expected behaviour, but in the case of collections, aggregation didn't work as expected so we end up with a collection of two objects in the Orders collection each with the original Amount.
We should investigate why it doesn't work for object collections.
Expected behavior
Result when object collections are used as a data source should mirror the result when Ef Core database provider is used.
Additional context
Implementing GetHashCode and Equals on Customer and Order models didn't resolve the issue.
The text was updated successfully, but these errors were encountered:
Assemblies affected
Describe the bug
EntitySet aggregation DOES NOT work as expected for object collections but works as expected for Ef Core database provider (InMemory and SqlServer).
Reproduce steps
To demonstrate how the issue can be repro'ed, let's define a simple OData service that works with both Ef Core InMemory database provider and object collections as data sources
Required packages:
Data models
Database context and collection objects initialization
Service configuration and Edm model definition
Controllers
Request/Response
Ef Core request:
http://localhost:5138/efcore/Customers?$apply=groupby((Name),aggregate(Orders(Amount with sum as OrdersTotal)))
Ef Core response:
Collection objects request:
http://localhost:5138/collection/Customers?$apply=groupby((Name),aggregate(Orders(Amount with sum as OrdersTotal)))
Collection object response:
What you'll above from the above responses is that the
OrdersTotal
for customerSue
is the aggregated total of 300 in the case of Ef Core - expected behaviour, but in the case of collections, aggregation didn't work as expected so we end up with a collection of two objects in theOrders
collection each with the originalAmount
.We should investigate why it doesn't work for object collections.
Expected behavior
Result when object collections are used as a data source should mirror the result when Ef Core database provider is used.
Additional context
Implementing
GetHashCode
andEquals
onCustomer
andOrder
models didn't resolve the issue.The text was updated successfully, but these errors were encountered: