title: ApplicationUserManager doesn't use my custom UserStore implementation
body: <p>I created a new MVC5 Application with ASP.NET Identity. I haven't changed lot of the files. This is the error I get:</p>
  
  <p><img src="https://i.stack.imgur.com/PeS6d.png" alt="Exception when using ApplicationManager"></p>
  
  <p>The following changes in the project differ from the VisualStudio template:</p>
  
  <h3>ApplicationUserManager.cs</h3>
  
  <pre><code>public class ApplicationUserManager : UserManager&lt;User&gt;
  {
      public ApplicationUserManager(IUserStore&lt;User&gt; userStore)
          : base(userStore)
      {
      }
  
      public static ApplicationUserManager Create(IdentityFactoryOptions&lt;ApplicationUserManager&gt; options, IOwinContext context)
      {
          // Use DI to resolve the UserStore
          var userStore = (IUserStore&lt;User&gt;) DependencyResolver.Current.GetService(typeof (IUserStore&lt;User&gt;));
  
          var manager = new ApplicationUserManager(userStore);
  
          // rest is same as in the template ...
      }
  }
  </code></pre>
  
  <p>My DependencyResolver is Ninject. I created the following Bindings for it:</p>
  
  <pre><code>Bind&lt;IMyDbContextFactory&gt;().To&lt;MyDbContextFactory&gt;().InSingletonScope();
  Bind&lt;IUserStore&lt;User&gt;&gt;().To&lt;UserStore&gt;().WithConstructorArgument("factory", factory =&gt; Kernel.Get&lt;MyDbContextFactory&gt;());
  </code></pre>
  
  <h3>UserStore.cs</h3>
  
  <pre><code>public class UserStore : IUserStore&lt;User&gt;,
      IUserLockoutStore&lt;User, string&gt;,
      IUserPasswordStore&lt;User&gt;,
      IUserTwoFactorStore&lt;User, string&gt;,
      IUserEmailStore&lt;User&gt;
  {
      private readonly IMyDbContextFactory _factory;
  
      public UserStore(IMyDbContextFactory factory)
      {
          _factory = factory;
      }
  
      public void Dispose()
      {
          // Nothing to dispose here
      }
  
      public Task CreateAsync(User user)
      {
          using (var context = _factory.CreateContext())
          {
              // TODO: Validation
              context.Users.Add(user);
              var result = context.SaveChanges();
              return Task.FromResult(result);
          }
      }
  
      // the rest of the implementend methods from the interfaces ...
  }
  </code></pre>
  
  <p>And for the sake of completeness the User entity, the DbContext and the factory I use to retrieve the DbContext in <code>UserStore.cs</code></p>
  
  <h3>User.cs</h3>
  
  <pre><code>public class User : IUser
  {
      public string Id { get; set; }
      public string UserName { get; set; }
      public string Password { get; set; }
      public string Email { get; set; }
      public object PhoneNumber { get; set; }
      public int AccessFailedCount { get; set; }
      public bool LockoutEnabled { get; set; }
      public DateTime? LockoutEndDateUtc { get; set; }
      public bool TwoFactorEnabled { get; set; }
  
      public virtual ICollection&lt;UserRole&gt; ApplicationUserRoles { get; set; }
      public virtual ICollection&lt;UserLogin&gt; ApplicationUserLogins { get; set; }
  }
  </code></pre>
  
  <h3>MyDbContextFactory.cs</h3>
  
  <pre><code>public class MyDbContextFactory : IMyDbContextFactory
  {
      public IMyDbContext CreateContext()
      {
          return new MyDbContext();
      }
  }
  </code></pre>
  
  <h3>MyDbContext.cs</h3>
  
  <pre><code>public class MyDbContext : DbContext, IMyDbContext
  {
      public MyDbContext()
          : base("MyDbContextConnection")
      {
          Configuration.LazyLoadingEnabled = false;
          Configuration.ProxyCreationEnabled = false;
  
          Database.Initialize(true);
      }
  
      // DbSets, OnModelCreating and other stuff ...
  }
  </code></pre>
  
  <p>The Exception implies that UserManager is null. But that's not true:</p>
  
  <p><img src="https://i.stack.imgur.com/zQRm1.png" alt="enter image description here"></p>
  
  <p>It seems that <code>ApplicationUserManager</code> doesn't really use (or sets) my injected UserStore. But why is that?</p>