This method is useful for retrieving instances of different objects that implement the same specified interface or that inherit from the same specified base class. The target type for the mapping (the TTo or to parameter in the following table) must inherit from or implement the base type or interface of the source (the TFrom or from parameter in the following table). The LifetimeManager passed to some of the methods controls when object instances are created and disposed. Unity contains default LifetimeManager types for singleton and instance registration. All of these methods return a reference to the UnityContainer upon which the method was called, equivalent to this in C# or Me in Visual Basic.
|
Method
|
Description
|
|
RegisterType<TFrom, TTo>( params InjectionMember[] injectionMembers)
|
Registers a default type mapping with the container so that it returns an instance of the type specified as TTo when a Resolve method requests an instance of the type TFrom.
|
|
RegisterType<TFrom, TTo>(LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Registers a default type mapping with the container so that it returns an instance of the type specified as TTo when a Resolve method requests an instance of the type TFrom. Also registers the specified LifetimeManager instance with the container to manage the lifetime of the returned object.
|
|
RegisterType<TFrom, TTo>(String name,params InjectionMember[] injectionMembers)
|
Registers a named type mapping with the container so that it returns an instance of the type specified as TTo when a Resolve method requests an instance of the type TFrom with the specified name. If name is null, generates a default type mapping. Names are case-sensitive.
|
|
RegisterType<TFrom, TTo>(String name, LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Registers a named type mapping with the container so that it returns an instance of the type specified as TTo when a Resolve method requests an instance of the type TFrom with the specified name. If name is null, generates a default type mapping. Names are case-sensitive. Also registers the specified LifetimeManager instance with the container to manage the lifetime of the returned object.
|
|
RegisterType<T>(LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Creates a default type registration with the container so that it returns an instance of that type in response to a call from the Resolve method. Allows you to register a LifetimeManager with the container to manage the lifetime of the registered type.
|
|
RegisterType<T>(String name, LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Creates a named type registration with the container so that it returns an instance of that type in response to a call from the Resolve method with the specified name. Allows you to register a LifetimeManager with the container to manage the lifetime of the registered type.
|
|
RegisterType(Type from, Type to,params InjectionMember[] injectionMembers)
|
Registers a default type mapping with the container so that it returns an instance of the type specified as to when a Resolve method requests an instance of the type from.
|
|
RegisterType(Type from, Type to, String name,params InjectionMember[] injectionMembers)
|
Registers a named type mapping with the container so that it returns an instance of the type specified as to when a Resolve method requests an instance of the type from with the specified name. If name is null, generates a default type mapping. Names are case-sensitive.
|
|
RegisterType(Type from, Type to, LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Registers a default type mapping with the container so that it returns an instance of the type specified as to when a Resolve method requests an instance of the type from. Also registers the specified LifetimeManager instance with the container to manage the lifetime of the returned object.
|
|
RegisterType(Type from, Type to, String name, LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Registers a named type mapping with the container so that it returns an instance of the type specified as to when a Resolve method requests an instance of the type from with the specified name. If name is null, generates a default type mapping. Names are case-sensitive. Also registers the specified LifetimeManager instance with the container to manage the lifetime of the returned object.
|
|
RegisterType(Type t, LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Creates a default type registration with the container so that it returns an instance of that type in response to a call from the Resolve method. Allows you to register a LifetimeManager with the container to manage the lifetime of the registered type.
|
|
RegisterType(Type t, String name, LifetimeManager lifetime,params InjectionMember[] injectionMembers)
|
Creates a named type registration with the container so that it returns an instance of that type in response to a call from the Resolve method with the specified name. Allows you to register a LifetimeManager with the container to manage the lifetime of the registered type.
|