I have the following code:
var data = repo.GetAll();
Mapper.CreateMap<Products_GetAll_Result, Product>();
return Mapper.Map<IEnumerable<Products_GetAll_Result>, List<FurnitureStore.Models.Product>>(data.ToList());
I get the following message in the exception:
{"Missing type map configuration or unsupported mapping.
Mapping types:
Products_GetAll_Result -> Product
FurnitureStore.DataLayer.Products_GetAll_Result -> FurnitureStore.Models.Product
Destination path:
List`1[0]
Source value:
FurnitureStore.DataLayer.Products_GetAll_Result"}
I tried anything I could think of but I can't get it to work. What am I doing wrong here?
Product
andFurnitureStore.Models.Product
are same class? – Leonid VasilevCreateMap
before everyMap
, just do it once. Or even useDynamicMap
without prior map creation if mapping between your types is trivial. – Leonid Vasilev