I am creating a class library to host my repositories, domain model, and my DTO. For example, when a user calls ClienteRepository.GetById (1), he must get the client's domain model and convert to ClientDTO in order to return this, for example:
public class ClientRepository{ public ClientDTO GetById(int id){ var clientDto = Mapper.Map<Client, ClientDTO>(_db.Client.Find(id)); return clientDto; } }
the problem is that Mapper.Map is not working because I did not create a map ( Mapper.CreateMap<Client, ClientDTO>() ).
My question is: how to do this in the class library if I don't have global.asax to create it?
source share