How to release and delete all objects with an Http scope in a container instance?

In StructureMap, how can I release and delete objects with an area of ​​Http environment on a specific container instance? For the default value in Object Factory, I can execute the method ReleaseAndDisposeAllHttpScopedObjects(), but the Container class and IContainer interface do not seem to have such a method.

+5
source share
1 answer

If you look at the insides ObjectFactory.ReleaseAndDisposeAllHttpScopedObjects, you will see that this is a convenience method implemented as follows:

public static void ReleaseAndDisposeAllHttpScopedObjects()
{
    HttpContextLifecycle.DisposeAndClearAll();
}

IE You can call a method HttpContextLifecycle.DisposeAndClearAllto clean objects.

: HttpContextLifecycle , , , Http.

+6

All Articles