microsoft-dependency-injection icon indicating copy to clipboard operation
microsoft-dependency-injection copied to clipboard

Does this have equivalant to PerRequestLifetimeManager?

Open UR-ScottShew opened this issue 4 years ago • 3 comments

The older Unity.Mvc library (for .NET Framework) had a PerRequestLifetimeManager that created object instances with the lifetime of one http request.

Unity.Mvc does not run in Asp.Net Core sites. Does this library have equivalent functionality? If so, would it be possible to provide an explanation or code snippet on its usage?

UR-ScottShew avatar Sep 18 '20 12:09 UR-ScottShew

It doesn’t have a manager like that. I am pretty sure it could be created if asp.net has session object that can be observed

ENikS avatar Sep 18 '20 16:09 ENikS

It does have an HttpContext class, which I believe is equivalent to what Unity.Mvc used. Do you think you could create a PerRequestLifetimeManager?

UR-ScottShew avatar Sep 18 '20 17:09 UR-ScottShew

I could try in v6, but it might be a while...

ENikS avatar Sep 18 '20 17:09 ENikS