Support mapping of polymorphic collection with abstract parent type#4304
Support mapping of polymorphic collection with abstract parent type#4304lbargaoanu merged 4 commits intoLuckyPennySoftware:basic_includefrom kvpt:basic_include_abstract
Conversation
| { | ||
| var instanceParameter = Parameter(request.SourceType, "dto" + request.SourceType.Name); | ||
| var projection = CreateProjectionCore(request, instanceParameter, typeMap, letPropertyMaps); | ||
| var projection = !typeMap.DestinationType.IsAbstract |
There was a problem hiding this comment.
A better fix is to simply skip abstract types when computing polymorphic maps.
There was a problem hiding this comment.
I disagree with that, or perhaps I don't see how to do it this way at this level.
Because the abstract type mapping don't come from the polymorphic map but from the EnumerableProjectionMapper.Project method.
This is because it is this abstract type that is used for the collection property in the entity.
I don't see how I can filter it before this moment.
There was a problem hiding this comment.
I guess both make sense, projecting to an abstract type when there are included maps and also including an abstract map, presumably for configuration reuse.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When mapping a polymorphic list with an abstract parent, the expression throw an exception on create.
It try to use a new expression of the abstract type which is not possible.
So replace it with a default value expression which is allowed and not throw an error.