I have the following Solution structure.
Solution
ProductServiceApi
Business
DataAccess
DTO
Contract
I am using EntityFramework in DataAccess layer. It has the .edmx file and entity classes(e.g. Product). I have my domain classes in DTO layer(ProductDto). I am creating the map in WebApiConfig.cs file. To map the DTO and DataAccess layer entities I have to add a reference to both DTO layer and DataAccess layer in ProductServiceApi.
e.g. Mapper.CreateMap<ProductDto, Product>();
But I think its a bad idea to add a reference to dataAccess layer in my ProductServiceApi.
What should I do to avoid this? Should I add a reference automapper in DTO layer and map the dto and entity there? What is the ideal solution. I have gone through some online tutorials but cannot find a proper solution.