title: Automapper 5.0 global configuration
body: <p>I am using the code below in <code>AutoMapperConfig.cs</code>  in <code>App_Start</code> folder. I
  initialized it in <code>Global.asax</code>  as  <code>AutoMapperConfiguration.Configure()</code></p>
  
  <p>But I am unable to use the <code>Mapper.Map&lt;Hospital, MongoHospital&gt;</code> in my
  controller. It is throwing an exception that no mappings are defined.  It
  was working in previous versions of Automapper which were supporting
  <code>Mapper.CreateMap&lt;&gt;</code> methods.  I am confused how to use
  <code>MapperConfiguration</code> instance.</p>
  
  <pre><code>public static class AutoMapperConfiguration
  {
      public static void Configure()
      {
          Mapper.Initialize(
              cfg =&gt;
                  {
                      cfg.AddProfile&lt;HospitalProfile&gt;();
                  }
          );
          Mapper.AssertConfigurationIsValid();
      }
  }
  
  public class HospitalProfile : Profile
  {
      protected override void Configure()
      {
          var config = new MapperConfiguration(
              cfg =&gt;
                  {
                      cfg.CreateMap&lt;Hospital, MongoHospital&gt;()
                          .ForMember(dest =&gt; dest.Id, opt =&gt; opt.MapFrom(src =&gt; src.Id.ToString()));
                  });
          config.CreateMapper();
      }
  }
  </code></pre>
  
  <p>Trying to access this map as below</p>
  
  <pre><code>Mapper.Map&lt;IEnumerable&lt;Hospital&gt;, IEnumerable&lt;MongoHospital&gt;&gt;(hospitalsOnDB);
  </code></pre>