Answer the question
In order to leave comments, you need to log in
What's the difference between OWINContext.Get() and its generic method?
When the application starts in the startup.cs class, I set the contexts of the database, user managers, and so on.
It is done like this:
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
context.Get<ApplicationDbContext>())
context.GetUserManager<ApplicationUserManager>()
Answer the question
In order to leave comments, you need to log in
1. habrahabr.ru/post/227351 - point 3, a custom manager is created and the type is not explicitly specified. I assume that in your example - if you remove the brackets with the type of manager, nothing criminal will happen.
2. Apparently because in the second case there is a stricter restriction on the method signature than just Get. And there, it may be necessary to use and call methods that are defined in the UserManager class, parent for all managers. GetUserManager<T>
And accordingly, there is a restriction in the method signature where <T> : UserManager
.
To be honest, I didn’t look at the source code as it really is, but I’m 90% sure that +/- is so
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question