Lifestyle Methods

Simple Injector

The Lifestyle type exposes the following members.

Methods

  NameDescription
Public methodStatic memberCode exampleCreateCustom
Creates a custom lifestyle using the supplied lifestyleApplierFactory delegate.
Public methodStatic memberCode exampleCreateHybrid(ScopedLifestyle, Lifestyle)
The hybrid lifestyle allows mixing two lifestyles in a single registration. The hybrid will use the defaultLifestyle in case its GetCurrentScope method returns a scope; otherwise the fallbackLifestyle is used. The hybrid lifestyle will redirect the creation of the instance to the selected lifestyle. By nesting hybrid lifestyles, any number of lifestyles can be mixed.
Public methodStatic memberCode exampleCreateHybrid(ScopedLifestyle, ScopedLifestyle)
The hybrid lifestyle allows mixing two lifestyles in a single registration. The hybrid will use the defaultLifestyle in case its GetCurrentScope method returns a scope; otherwise the fallbackLifestyle is used. The hybrid lifestyle will redirect the creation of the instance to the selected lifestyle. By nesting hybrid lifestyles, any number of lifestyles can be mixed.
Public methodStatic memberCode exampleCreateHybrid(FuncBoolean, Lifestyle, Lifestyle)
The hybrid lifestyle allows mixing two lifestyles in a single registration. Based on the supplied lifestyleSelector delegate the hybrid lifestyle will redirect the creation of the instance to the correct lifestyle. The result of the lifestyleSelector delegate will not be cached; it is invoked each time an instance is requested or injected. By nesting hybrid lifestyles, any number of lifestyles can be mixed.
Public methodStatic memberCode exampleCreateHybrid(FuncBoolean, ScopedLifestyle, ScopedLifestyle)
The hybrid lifestyle allows mixing two lifestyles in a single registration. Based on the supplied lifestyleSelector delegate the hybrid lifestyle will redirect the creation of the instance to the correct lifestyle. The result of the lifestyleSelector delegate will not be cached; it is invoked each time an instance is requested or injected. By nesting hybrid lifestyles, any number of lifestyles can be mixed.
Public methodCreateProducer(Type, Type, Container)
Creates a new InstanceProducer instance for the given serviceType that will create new instances of specified implementationType with the caching as specified by this lifestyle.
Public methodCreateProducerTService(FuncTService, Container)
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.
Public methodCreateProducerTService(Type, Container)
Creates a new InstanceProducer instance for the given TService that will create new instances of specified implementationType caching as specified by this lifestyle.
Public methodCreateProducerTService, TImplementation(Container)
Creates a new InstanceProducer instance for the given TService that will create new instances of specified TImplementation with the caching as specified by this lifestyle.
Public methodCreateRegistration(Type, Container)
Creates a new Registration instance defining the creation of the specified concreteType with the caching as specified by this lifestyle, or returns an already created Registration instance for this container + lifestyle + type combination. This method might fail when run in a partial trust sandbox when concreteType is an internal type.
Public methodCreateRegistration(Type, FuncObject, Container)
Creates a new Registration instance defining the creation of the specified serviceType using the supplied instanceCreator with the caching as specified by this lifestyle.
Public methodCreateRegistration(Type, Type, Container) Obsolete.
This overload has been deprecated. Please call CreateRegistration(Type, Container) instead.
Public methodCreateRegistrationTConcrete(Container)
Creates a new Registration instance defining the creation of the specified TConcrete with the caching as specified by this lifestyle, or returns an already created Registration instance for this container + lifestyle + type combination.
Public methodCreateRegistrationTService(FuncTService, Container)
Creates a new Registration instance defining the creation of the specified TService using the supplied instanceCreator with the caching as specified by this lifestyle.
Public methodCreateRegistrationTService, TImplementation(Container) Obsolete.
Protected methodCreateRegistrationCoreTConcrete(Container)
When overridden in a derived class, creates a new Registration instance defining the creation of the specified TConcrete with the caching as specified by this lifestyle.
Protected methodCreateRegistrationCoreTService(FuncTService, Container)
When overridden in a derived class, creates a new Registration instance defining the creation of the specified TService using the supplied instanceCreator with the caching as specified by this lifestyle.
Top
See Also

Reference