Registers the specified delegate instanceCreator that will produce instances of type serviceType and will be returned when an instance of type serviceType is requested. The delegate is expected to produce new instances on each call. The instances are cached according to the supplied lifestyle.
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 4.3.0
public void Register( Type serviceType, Func<Object> instanceCreator, Lifestyle lifestyle )
Public Sub Register ( serviceType As Type, instanceCreator As Func(Of Object), lifestyle As Lifestyle )
- Type: SystemType
The interface or base type that can be used to retrieve instances.
- Type: SystemFuncObject
The delegate that allows building or creating new instances.
- Type: SimpleInjectorLifestyle
The lifestyle that specifies how the returned instance will be cached.
|InvalidOperationException||Thrown when this container instance is locked and can not be altered, or when the serviceType has already been registered.|
|ArgumentNullException||Thrown when one of the supplied arguments is a null reference (Nothing in VB).|