title: Automapper 4.2 Unity Inject MapperConfiguration
body: <p>I can't quite figure how to convert the following structure map implementation to unity.</p>
  
  <pre><code>public AutoMapperRegistry()
  {
      var profiles =
          from t in typeof (AutoMapperRegistry).Assembly.GetTypes()
          where typeof (Profile).IsAssignableFrom(t)
          select (Profile)Activator.CreateInstance(t);
  
      var config = new MapperConfiguration(cfg =&gt;
      {
          foreach (var profile in profiles)
          {
              cfg.AddProfile(profile);
          }
      });
  
      For&lt;MapperConfiguration&gt;().Use(config);
      For&lt;IMapper&gt;().Use(ctx =&gt; ctx.GetInstance&lt;MapperConfiguration&gt;().CreateMapper(ctx.GetInstance));
  }
  </code></pre>