I have created a controller named ProfileContoller
in my application.
In this controller I need to creat an instance of ApplicationUserManager
however I don't know how to create a new instance of it. I've tried code below:
private ApplicationUserManager _userManager = Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
but I got this error:
The name
Current
does not exist in the current context
My first question is how could I do this? I'll acces this line of code:
return View(await _userManager.FindByNameAsync(username));
I also use an UnityContainer
. My second question about this is: could I also register the ApplicationUserManager
associated with the interface IUser
or IUserStore
1.
Update:
Later I've found there is something like this:
private UserManager<ApplicationUser> _userManager = UserManager<ApplicationUserManager>();
Bit it give me this error:
Non-invocable member
UserManager<TUser>
cannot be used like a method.
With this extra "user manager", I can't see the I can't see the wood for the trees. So once more can you explain me what all the "user managers" mean and what they are used for?
Notes:
1 I don't know the difference between this two so if you'll, can you explane this too?