title: AutoMapper in a class library
body: <p>I create a class library to put my repositories, domain model and my DTO.
  When a user call ClienteRepository.GetById(1) for exemple, it should get the Client domain model and transform into a ClientDTO to return this, example:</p>
  
  <pre><code>public class ClientRepository{
       public ClientDTO GetById(int id){
            var clientDto = Mapper.Map&lt;Client, ClientDTO&gt;(_db.Client.Find(id));
  
            return clientDto;
       }
  
  }
  </code></pre>
  
  <p>the problem is that Mapper.Map doesn't work because I did not create the map (<code>Mapper.CreateMap&lt;Client, ClientDTO&gt;()</code>).</p>
  
  <p>My question: How can I do this in a class library if I dont have global.asax to create it?</p>