Posted on: 12/1/2015 10:39:58 PM | Views : 3442

In Startup.cs I am using Lambdas to create an instance of my UserManager class:
app.CreatePerOwinContext(() => new IdentityContext("AuthDatabase")); app.CreatePerOwinContext((IdentityFactoryOptions<UserManager> options, IOwinContext owin) => new UserManager(new UserStore<User, Role, Guid, UserLogin, UserRole, UserClaim>(owin.Get<IdentityContext>()), options.DataProtectionProvider)); In one of my controllers I'm using a Lambda to retrieve the UserManager instance:
private UserManager UserManager => _userMan ?? (_userMan = Request.GetOwinContext().GetUserManager<UserManager>()); But this line doesn't execute above Lambdas. Instead GetUserManager() always returns null.
What's wrong with above code? Why are the callbacks never called?

Go to the complete details ...