Reputation: 6394
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?
Upvotes: 0
Views: 12048
Reputation: 337
You could use that:
Mapper.CreateMap<Products_GetAll_Result, Product>().ReverseMap();
Upvotes: 2
Reputation: 3747
EDIT
When you create your mapping
Mapper.CreateMap<Products_GetAll_Result, Product>();
Why are you not using FurnitureStore.Models.Product
? As when you are mapping you are using FurnitureStore.Models.Product
rather than just Product
class. (Assuming both classes are different)
EDIT
Removed the code which was redundant as OP's mapping style was correct
Upvotes: 5