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 ?
On the legacy OData library, the support for cast in
$expand
expression has been added with the following PR https://github.com/OData/odata.net/pull/2300Quote 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 theparentType
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