title: Configuring the latest version of AutoMapper at the Global.asax level in an ASP.NET MVC Application
body: <p>I am trying to figure out how to configure the new AutoMapper at the Global.asax level.</p>
  
  <p><strong>I used to do the following with old AutoMapper:</strong></p>
  
  <p>Create a class in App_Start folder called MappingProfile.cs and in the constructor I would add my mappings like this:</p>
  
  <pre><code>public MappingProfile()
  {
       Mapper.CreateMap&lt;Product, ProductDto&gt;();
       Mapper.CreateMap&lt;ApplicationUser, UserDto&gt;();
  }
  </code></pre>
  
  <p>Then in Global.asax call:</p>
  
  <pre><code>Mapper.Initialize(cfg =&gt; cfg.AddProfile&lt;MappingProfile&gt;());
  </code></pre>
  
  <p>Can someone please tell me how to achieve the above with the new version of AutoMapper? I have been reading the docs but can't seem to get it.</p>
  
  <p><strong>I believe I do something like this in my MappingProfile.cs file:</strong></p>
  
  <pre><code>    var config = new MapperConfiguration(cfg =&gt;
      {
         cfg.CreateMap&lt;Product, ProductDto&gt;();
         cfg.CreateMap&lt;ApplicationUser, UserDto&gt;();
      });
  </code></pre>
  
  <p>but what do I do with the config variable?</p>