title: ASP.NET MVC multilayered application: where to place Automapper initialization?
body: <p>I'm creating a multilayered application, having an asp.net mvc application as the highest layer.</p>
  
  <p>The architecture is the following (---> means references):</p>
  
  <p>Presentation layer ---> Service Layer ---> Business layer ----> Data access layer ----> Database</p>
  
  <p>Furthermore, there is a layer called "Infrastracture" which is referenced by all layers.</p>
  
  <p>Each layer has it's own entities. For example: in the presentation layer we might have UserViewModel, in the service layer UserDTO, in the business layer UserBDO and finally, in the data access layer, User.</p>
  
  <p>The automapper is used to automate the conversion between different types.</p>
  
  <p>I read that some developers suggest to place the mappings creation in Global.asax, but it's obvious that if you have a multilayered application you can not create all mappings there. You can't map User with UserBDO in the presentation layer.</p>
  
  <p>So, I'm asking the cleanest way to manage the mapping centralization in a multilayred application. You can even suggest changes in the architecture.</p>