c# - How to release and dispose all Http-scoped objects on Container instance? -
in structuremap, how can release , dispose al http-scoped objects on specific container instance? default intance in object factory, can execute method releaseanddisposeallhttpscopedobjects()
, container class , icontainer interface doesn't seem have such method.
if @ internals of objectfactory.releaseanddisposeallhttpscopedobjects
, can see conveniency method implemented this:
public static void releaseanddisposeallhttpscopedobjects() { httpcontextlifecycle.disposeandclearall(); }
ie. can invoke httpcontextlifecycle.disposeandclearall
method clear objects.
edit: since httpcontextlifecycle global , not per container, think nested container approach solution gain more fine grained control on object lifetime during http request.
Comments
Post a Comment