title: How to add MVC 5 authentication to Unity IoC?
body: <p>I'm currently working on implementing the new ASP.NET MVC 5 out-of-the box authentication into my application. However when using Unity as my IoC, I cannot use any portion of the AccountController because I'm given the error:</p>
  
  <blockquote>
    <p>The type IUserStore`1 does not have an accessible constructor.</p>
  </blockquote>
  
  <p>This is my given unity setup which is called in the global.asax</p>
  
  <pre><code>public class DependencyConfig
  {
      public static void Initialise()
      {
          var container = BuildUnityContainer();
  
          DependencyResolver.SetResolver(new UnityDependencyResolver(container));
      }
  
      private static IUnityContainer BuildUnityContainer()
      {
          var container = new UnityContainer();
  
          // register all your components with the container here
          // it is NOT necessary to register your controllers
  
          container.RegisterType&lt;IEmployeeRepository, EmployeeRepository&gt;();
  
          container.RegisterType&lt;ITeamRepository, TeamRepository&gt;();
  
          container.RegisterType&lt;ICompanyRepository, CompanyRepository&gt;();
  
          return container;
      }
  }
  </code></pre>
  
  <p>And here are the default constructors of a fresh AccountController.cs</p>
  
  <pre><code>public AccountController()
          : this(new UserManager&lt;ApplicationUser&gt;(new UserStore&lt;ApplicationUser&gt;(new BusinessTrackerUsersContext())))
  {
  
  }
  
  public AccountController(UserManager&lt;ApplicationUser&gt; userManager)
  {
      UserManager = userManager;
  }
  
  public AccountController(UserManager&lt;ApplicationUser&gt; userManager)
  {
      UserManager = userManager;
  }
  </code></pre>
  
  <p>And here are the items being called in the AccountController constructors. These are the defaults with new names.</p>
  
  <pre><code>public class BusinessTrackerUsersContext : IdentityDbContext&lt;ApplicationUser&gt;
  {
      public BusinessTrackerUsersContext()
          : base("DefaultConnection")
      {
  
      }
  }
  
  public class ApplicationUser : IdentityUser
  {
  
  }
  </code></pre>
  
  <p>Any help would be widely appreciated!</p>