You will need to create several classes to simplify the injection process.
Let's start with UserStore. Create the desired interface and inherit it from IUserStore<ApplicationUser>
public IUserStore : IUserStore<ApplicationUser> { }
Create an implementation as follows.
public ApplicationUserStore : UserStore<ApplicationUser>, IUserSTore { public ApplicationUserStore(ApplicationDbContext dbContext) :base(dbContext) { } }
Then the user manager can be executed as desired in the OP.
public class ApplicationUserManager : UserManager<ApplicationUser> { public ApplicationUserManager(IUserSTore userStore) : base(userStore) { } }
SO now all that remains is to make sure that in any IoC container you decide to use registers for the required classes.
ApplicationDbContext --> ApplicationDbContext IUserStore --> ApplicationUserStore
If you want to take a step further and distract the UserManager, then just create an interface that provides the necessary functions
public interface IUserManager<TUser, TKey> : IDisposable where TUser : class, Microsoft.AspNet.Identity.IUser<TKey> where TKey : System.IEquatable<TKey> { //...include all the properties and methods to be exposed IQueryable<TUser> Users { get; } Task<TUser> FindByEmailAsync(string email); Task<TUser> FindByIdAsync(TKey userId); //...other code removed for brevity } public IUserManager<TUser> : IUserManager<TUser, string> where TUser : class, Microsoft.AspNet.Identity.IUser<string> { } public IApplicationUserManager : IUserManager<ApplicationUser> { }
and you have a manager inherited.
public class ApplicationUserManager : UserManager<ApplicationUser>, IApplicationUserManager { public ApplicationUserManager(IUserSTore userStore) : base(userStore) { } }
Now this means that now the controller may depend on abstraction, and not on implementation problems
private readonly IApplicationUserManager userManager; public AccountController(IApplicationUserManager userManager) { this.userManager = userManager; }
And again, you register the implementation interface in the IoC container.
IApplicationUserManager --> ApplicationUserManager
UPDATE:
If you feel adventurous and want to distract the very framework of identification, look at the answer provided here