I am using an Automapper and I need to map a list of objects to a single complex type, which has a lot of nested objects, but I can't find what may be the right way to do that. Of course I have a lot more concrete objects, but I'm just simplifying my situation.
Source:
public abstract class SourceBase
{
public int? Value { get; set; }
}
public class Source1 : SourceBase
{
}
public class Source2 : SourceBase
{
}
Destination:
public abstract class DestBase
{
public int? Value { get; set; }
}
public class Dest1 : DestBase
{
}
public class Dest2 : DestBase
{
}
I have this response from the service:
public List<SourceBase> Foo { get; set; }
And I want to map it into this object:
public class DestObj
{
public Dest1 Dest1Obj { get; set; }
public Dest2 Dest2Obj { get; set; }
}
Thank you!
SourceBase? Why not map it to a list ofDestBase?