mapping inheritance

May 27, 2014 at 7:29 PM
Hello,
I'm trying to map 2 DTOs where both have property of a base type but the actual objects might be a child of that base type and I need to map the most derived type.
I'm looking for something similar, or the best pattern in emitmapper, to AutoMapper's .Include<> (see doc)

For example:
I have this DTO
class CarRA { // as in resource access
BrandRA Brand;
}

class BrandRA {
int Id;
}

class FullBrandRA : BrandRA {
String Name;
}
and I want to map to the same thing,
class Car { 
Brand Brand;
}

class Brand {
int Id;
}

class FullBrand : Brand {
String Name;
}
I always get cars with the base brand type even if the DTO has uses a FullBrand.