0
imad created
Hi,
How to achieve Dto inheritence in order for base and derived class map correctly to their correspondent Dto?
in the following example, i am always getting the ProductDto even if the product is a ProductA instance, how to make it map to ProductADto?
public class Product {}
public class ProductA : Product {}
[AutoMap(typeof(Product)]
public class ProductDto {}
[AutoMap(typeof(ProductA)]
public class ProductADto {}
public class GetProductForEditOutput
{
public Product EditProduct { get; set; }
}
1 Answer(s)
-
0
Hi,
You need to configure automapper like this <a class="postlink" href="https://github.com/AutoMapper/AutoMapper/wiki/Mapping-inheritance">https://github.com/AutoMapper/AutoMappe ... nheritance</a>.
Thanks.