title: Unity the The type IRegisterAutoMapper does not have an accessible constructor
body: <p>Hi I am using Unity as my IoC container and am trying to get an instance of an object using ServiceLocator.</p>
  
  <p>This is the code I am trying to execute:</p>
  
  <pre><code>ServiceLocator.Current.GetInstance&lt;IAutoMapperRegisterFactory&gt;()
  </code></pre>
  
  <p>I have set in my configuration file the object that unity has to instantiate:</p>
  
  <pre><code>container.RegisterType&lt;IAutoMapperRegisterFactory, AutoMapperRegisterFactory&gt;();
  </code></pre>
  
  <p>Now my curent AutoMapperRegisterFactory looks something like this:</p>
  
  <pre><code>public class AutoMapperRegisterFactory : IAutoMapperRegisterFactory
  {
      private readonly IRegisterAutoMapper m_RegisterAutoMapper;
  
      public AutoMapperRegisterFactory(IRegisterAutoMapper registerAutoMapper)
      {
          m_RegisterAutoMapper = registerAutoMapper;
      }
  
      public IEnumerable&lt;IRegisterAutoMapper&gt; GetRegisteredAutoMappers()
      {
          var registeredAutoMappers = new List&lt;IRegisterAutoMapper&gt; { m_RegisterAutoMapper };
          return registeredAutoMappers;
      }
  }
  </code></pre>
  
  <p>And if I try to run this I get this error:</p>
  
  <pre><code> The type IRegisterAutoMapper does not have an accessible constructor.
  </code></pre>
  
  <p>Previously my AutomapperRegisterFactory looked like this:</p>
  
  <pre><code>public class AutoMapperRegisterFactory : IAutoMapperRegisterFactory
  {
      public IEnumerable&lt;IRegisterAutoMapper&gt; GetRegisteredAutoMappers()
      {
          var registeredAutoMappers = new List&lt;IRegisterAutoMapper&gt; { new RegisterAutoMapper(new RegisterMappings(), new RegisterCustomMappings()) };
          return registeredAutoMappers;
      }
  }
  </code></pre>
  
  <p>And everything worked just fine.What am I doing wrong and how can I correct it?</p>