Skip to content
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

Support for casting in $expand #199

Open
orty opened this issue Nov 30, 2023 · 1 comment
Open

Support for casting in $expand #199

orty opened this issue Nov 30, 2023 · 1 comment

Comments

@orty
Copy link

orty commented Nov 30, 2023

On the legacy OData library, the support for cast in $expand expression has been added with the following PR OData/odata.net#2300

Quote from the OData repository:
(...)~/Orders?$expand=Customer/Model.VipCustomer
This means that we will expand only the Customers that are an instance of Model.VipCustomer.
Note: Model.VipCustomer is a derived type of the Customer.

This behavior does not seem to be supported by this library so far. I tried to tweak the AutoMapper.AspNet.OData.LinqExtensions.GetExpansions‎(IEnumerable<SelectItem>‎ selectedItems‎,‎ Type‎ parentType‎,‎ IEdmModel‎ edmModel‎) method to do so, but the furthest I can get to is to force the parentType to the derived type specified by the query.
As it does not "trim" out the other derived types (or base type either), if the property I need to $select or whatever inside my $expand is only declared in my specific derived type, I receive errors of a missing member.

@BlaiseD is this something you plan to support with your library ?

Thanks

@orty
Copy link
Author

orty commented Dec 1, 2023

Adding reference to proposed PRs on both
AutoMapper.Extensions.OData #200
and
LogicBuilder.DataComponents #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant