This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Regression when calling ProjectTo to a basedto class on a DbSet of a subclass if a polymorphic mapping to a -different- subclass exists #4395
Labels
Milestone
Source/destination types
Mapping configuration
Version: 13.0.1
Expected behavior
with context.Cars being a DbSet of Cars should not throw an error.
Actual behavior
an error is thrown:
No coercion operator is defined between types 'Car' and 'Motorcycle'
Steps to reproduce
Gist
This code works in Automapper 12. The issue seems to be caused by there being an explicit mapping for one of the Vehicle subclasses, but not the other. Adding an explicit map fixes the issue.
Removing the map from Motorcycle to MotorcycleDto also fixes the issue, allowing
to execute properly.
The text was updated successfully, but these errors were encountered: