Ignore mapping one property with Automapper

I’m using Automapper and I have the following scenario:
Class OrderModel has a property called ‘ProductName’ that isn’t in the database.
So when I try to do the mapping with:

Mapper.CreateMap<OrderModel, Orders>(); 

It generates an exception :

“The following 1 properties on Project.ViewModels.OrderModel are not mapped: ‘ProductName’

I’ve read at AutoMapper’s Wiki for Projections the opposite case (the extra attribute is on the destination, not in the source which is actually my case )

How can I avoid automapper to make the mapping of this property?

9 Answers
9

Leave a Comment