Open albertoVieiraNeto opened 6 years ago
maybe related to https://github.com/OData/WebApi/issues/1564, since both are related to $count with expand.
indeed they are related, I've found both of these issues when working on the same task when used with a function the counts works in this crazy way and when used on a default function it throws a error like the other issue.
Short Description
After creating a custom Function on odata if one the navigation properties is expanded and a count added inside this expand, the numbers returned are completely wrong.
Assemblies affected
Version affected/Tested : Microsoft.AspNetCore.OData @7.0.1
Reproduce steps
register a custom function on the model builder:
Create a function on the controller:
Models Used
Url that causes the error
Expected result
Each expanded item should show the correct number of item for this collection.
Actual result
Each expanded item shows a completely wrong number even though the query seem correct when analised using the sql server profiler.
Querys genereated
i got the querys this function generates using the profiler, they seem correct: