Created
April 13, 2014 15:17
-
-
Save xivSolutions/10588256 to your computer and use it in GitHub Desktop.
To Inject or Not To Inject UserManager?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Identity 2.0 example project has a Constructor Override: | |
public AccountController() | |
{ | |
} | |
// When would we do THIS? | |
public AccountController(ApplicationUserManager userManager) | |
{ | |
UserManager = userManager; | |
} | |
// When THIS exists? | |
private ApplicationUserManager _userManager; | |
public ApplicationUserManager UserManager | |
{ | |
get | |
{ | |
return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); | |
} | |
private set | |
{ | |
_userManager = value; | |
} | |
} | |
// Is there strong reason for or against injecting the UserManager? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment