unitycontainer / microsoft-dependency-injection

Unity.Microsoft.DependencyInjection package
Apache License 2.0
63 stars 36 forks source link

Does this have equivalant to PerRequestLifetimeManager? #84

Open UR-ScottShew opened 4 years ago

UR-ScottShew commented 4 years ago

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?

ENikS commented 4 years ago

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

UR-ScottShew commented 4 years ago

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

ENikS commented 4 years ago

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