Guidance needed. #153
Unanswered
marthiniusj
asked this question in
Q&A
Replies: 1 comment
-
There are tests e.g. here showing the expansions filter working independently of the root filter. I see your scenario includes a filter in the map using plus a parameter. Maybe you can isolate the one thing causing the unexpected result? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good day.
I’m hoping someone could help me out.
I’ve forked this repo and modified it a bit to illustrate the problem I’m having, please feel free to pull and run it yourself.
https://github.com/marthiniusj/AutoMapper.Extensions.OData
We’re trying to make use of the ProjectionSetting Parameter property to apply additional filters on our mapping profiles.
Have a look at the OptSentantController class, line 62 to 73.
https://github.com/marthiniusj/AutoMapper.Extensions.OData/blob/master/WebAPI.OData.EFCore/Controllers/OpsTenantController.cs
Then have a look at the CoreBuildingMappings class, line 21.
https://github.com/marthiniusj/AutoMapper.Extensions.OData/blob/master/WebAPI.OData.EFCore/Mappings/CoreBuildingMappings.cs
I then execute the following URL and I’m getting back the results shown below.
http://localhost:16324/opscity?$expand=Builders($expand=Buildings;$filter=Buildings/any())&$filter=Builders/any()
The mapping filter kicks in, because I’m only seeing the builder that I want, which is builderId = 1 (John in green) for the first city, London.
But the root /any() filter breaks (yellow block), because I still get back the second city, Leeds, even though the builders are empty.
So somehow, my mapping filter and the builders/any() filter don’t work well together.
Could you please show me what I’m doing wrong and how else I could achieve my goal of adding extra filters on the profile/controller level?
Beta Was this translation helpful? Give feedback.
All reactions