Registration Class

Simple Injector
A Registration implements lifestyle based caching for a single service and allows building an Expression that describes the creation of the service.
Inheritance Hierarchy

SystemObject
  SimpleInjectorRegistration

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

public abstract class Registration

The Registration type exposes the following members.

Constructors

  NameDescription
Protected methodRegistration
Initializes a new instance of the Registration class.
Top
Properties

  NameDescription
Public propertyContainer
Gets the Container instance for this registration.
Public propertyImplementationType
Gets the type that this instance will create.
Public propertyLifestyle
Gets the Lifestyle this that created this registration.
Top
Methods

  NameDescription
Public methodBuildExpression
Builds a new Expression with the correct caching (according to the specifications of its Lifestyle) applied.
Protected methodBuildTransientDelegate
Protected methodBuildTransientDelegateTService(FuncTService)
Builds a FuncTResult delegate for the creation of the TService using the supplied instanceCreator. The returned FuncTResult might be intercepted by a Container.ExpressionBuilding event, and the instanceCreator will have been wrapped with a delegate that executes the registered initializers that are applicable to the given TService (if any).
Protected methodBuildTransientExpression
Builds an Expression that describes the creation of ImplementationType. The returned Expression might be intercepted by a Container.ExpressionBuilding event, and the creation of the ImplementationType will have been wrapped with a delegate that executes the registered initializers that are applicable to the InstanceProducer's ServiceType (if any).
Protected methodBuildTransientExpressionTService(FuncTService)
Builds an Expression that describes the creation of the TService using the supplied instanceCreator. The returned Expression might be intercepted by a Container.ExpressionBuilding event, and the instanceCreator will have been wrapped with a delegate that executes the registered initializers that are applicable to the given TService (if any).
Public methodGetRelationships
Gets the list of KnownRelationship instances. Note that the list is only available after calling BuildExpression.
Public methodInitializeInstance
Initializes an already created instance and applies properties and initializers to that instance.
Public methodSuppressDiagnosticWarning
Suppressing the supplied DiagnosticType for the given registration.
Top
Remarks

Lifestyle implementations create a new Registration instance for each registered service type. Expressions returned from the BuildExpression method can be intercepted by any event registered with ExpressionBuilding, have initializers applied, and the caching particular to its lifestyle have been applied. Interception using the Container.ExpressionBuilt will not be applied in the Registration, but will be applied in InstanceProducer.
Examples

See the Lifestyle documentation for an example.
See Also

Reference