ScopedLifestyleRegisterForDisposal Method

Simple Injector
Adds the disposable to the list of items that will get disposed when the scope ends.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 4.0.0
Syntax

public void RegisterForDisposal(
	Container container,
	IDisposable disposable
)

Parameters

container
Type: SimpleInjectorContainer
The Container instance.
disposable
Type: SystemIDisposable
The instance that should be disposed when the scope ends.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when one of the arguments is a null reference (Nothing in VB).
InvalidOperationExceptionWill be thrown when there is currently no active scope for the supplied container.
See Also

Reference