I'm using .Net Core with latest automapper version and I've a question on nested objects.
I've a view model like below (This I can't change as its a 3rd party one):
public class MyTempA
{
string ShapeName;
object ShapeDetails;
//....some other props
}
I've db classes and view models for below
- Square (DB Entity)
- SquareViewModel
- Pyramid (DB Entity)
- PyramidViewModel
- Cylinder (DB Entity)
- CylinderViewModel
I've individual mappers existing for above DB entities to view models.
My question: ShapeDetails object in MyTempA can be any of the view models based on ShapeName. How can I map that using Automapper?
If ShapeName is Square, ShapeDetails should be SquareViewModel (mapped from Square db class).
Thanks