This project is read-only.

Callbacks in CreatePerOwinContext() never called - what's wrong?

Dec 1, 2015 at 1:03 AM
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?