OWIN Katana: Lifetime and Scale Confusion with AspNet.Identity

I am new to OWIN and I have implemented a solution using AspNet.Identity. There are several coded strings in the launch configuration, similar to the following ...

        app.CreatePerOwinContext(ApplicationDbContext.Create);
        app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);

      

Now every object (ApplicationDbContext, ApplicationUserManager, etc.) has a Create method that takes an Owin parameter and context. I'm not sure at what point the Create method is called, the lifespan and scope of the object. The following is what I believe in, but can anyone tell me if I got it right or misunderstood ...

  • Startup.Configuration is called only once when the application starts.
  • ApplicationUserManager will be created for each request
  • Executing HttpContext.GetOwinContext (). Get () will get the same ApplicationUserManager object every time it is called, it will not create a new one every time.
  • All objects I receive this way will be removed at the end of each request.
  • Objects are not persisted between requests.

Statement 5 is my real attraction. How would I like to say that the session-specific objects say that if I want to hold onto the ApplicationUser object during login without having to get it from the database every time? Also can I store specific application objects for caching?

Here's a link to where I came up with this understanding, but it doesn't talk about session or application scope ...

http://blogs.msdn.com/b/webdev/archive/2014/02/12/per-request-lifetime-management-for-usermanager-class-in-asp-net-identity.aspx

From the moment of writing this, I just realized that HttpContext has Session and Application properties that would have to host these scoped objects.

+3
c # asp.net asp.net-identity owin katana


source to share


No one has answered this question yet

Check out similar questions:

319
How to explain Katana and OWIN in simple terms and uses?
247
When should you use OWIN Katana?
38
UserStore injection dependency in OWIN startup using Ninject OWIN middleware
6
New ApplicationDbContext () vs HttpContext.GetOwinContext (). Get <ApplicationDbContext> ();
4
AutoFac with ASP.Identity
4
Can OWIN replace DI in ASP.NET MVC application?
2
ASp.net identity 2.0 Samples - Controller Constructors, DB Constructor Reuse, and Owin Middleware
1
Cannot resolve symbol "Owin"
1
ASP.NET MVC (default template) - OWIN generates each class twice per request
1
ASP.NET 2.0 identifier. DbContext Object Lifetime Management



All Articles
Loading...
X
Show
Funny
Dev
Pics