LifestyleCreateProducerTService Method (FuncTService, Container)

Simple Injector
Creates a new InstanceProducer instance for the given TService that will create new instances instance using the supplied instanceCreator with the caching as specified by this lifestyle.

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

public InstanceProducer<TService> CreateProducer<TService>(
	Func<TService> instanceCreator,
	Container container
)
where TService : class

Parameters

instanceCreator
Type: SystemFuncTService
A delegate that will create a new instance of TService every time it is called.
container
Type: SimpleInjectorContainer
The Container instance for which a InstanceProducer must be created.

Type Parameters

TService
The interface or base type that can be used to retrieve the instances.

Return Value

Type: InstanceProducerTService
A new InstanceProducer instance.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when either instanceCreator or container are null references (Nothing in VB).
See Also

Reference