I know various questions have been asked that resembles this question, but as far as I can tell (and test), none of the provided solutions seems to fit, so here goes.
I am wondering if it is possible to flatten/denormalise an object hierarchy so that an instance with a list of nested properties is mapped to a list of some destination type using AutoMapper.
I have a source class that looks something like
Sources:
public class DistributionInformation
{
public string Streetname;
public RouteInformation[] Routes;
}
public class RouteInformation
{
public int RouteNumber;
public string RouteDescription;
}
Destination:
public class DenormDistributionInfo
{
public string Streetname;
public int RouteNumber;
public string RouteDescription;
}
So I want to map the two sources to a list of the denormalised destination DenormDistributionInfo.
I.e:
IEnumerable<DenormDistributionInfo> result = Mapper.Map(distributionInformationInstance);
Is that possible/feasible using AutoMapper, or should I give in and denormalise it "manually"?