C# 클래스 Catel.IoC.TypeFactory

Type factory which will cache constructors to ensure the best performance available. This class will automatically watch the IServiceLocator.TypeRegistered event and clear the cache automatically when the event occurs.
상속: ITypeFactory
파일 보기 프로젝트 열기: Catel/Catel

공개 메소드들

메소드 설명
ClearCache ( ) : void

Clears the cache of all constructors. This call is normally not necessary since the type factory should keep an eye on the IServiceLocator.TypeRegistered event to invalidate the cache.

CreateInstance ( Type typeToConstruct ) : object

Creates an instance of the specified type using dependency injection.

CreateInstanceWithParameters ( Type typeToConstruct ) : object

Creates an instance of the specified type using the specified parameters as injection values.

CreateInstanceWithParametersAndAutoCompletion ( Type typeToConstruct ) : object

Creates an instance of the specified type using the specified parameters as injection values. This method will also auto-complete any additional dependencies that can be resolved from the IServiceLocator.

CreateInstanceWithParametersAndAutoCompletionWithTag ( Type typeToConstruct, object tag ) : object

Creates an instance of the specified type using the specified parameters as injection values. This method will also auto-complete any additional dependencies that can be resolved from the IServiceLocator.

CreateInstanceWithParametersWithTag ( Type typeToConstruct, object tag ) : object

Creates an instance of the specified type using the specified parameters as injection values.

CreateInstanceWithTag ( Type typeToConstruct, object tag ) : object

Creates an instance of the specified type using dependency injection.

TypeFactory ( IServiceLocator serviceLocator ) : System

Initializes a new instance of the TypeFactory class.

비공개 메소드들

메소드 설명
CanConstructorBeUsed ( ConstructorInfo constructor, object tag, bool autoCompleteDependencies ) : bool

Determines whether the specified constructor can be used for dependency injection.

CloseCurrentTypeIfRequired ( Catel.IoC.TypeRequestInfo typeRequestInfoForTypeJustConstructed ) : void

Marks the specified type as not being created. If this was the only type being constructed, the type request path will be closed.

CompleteTypeRequestPathIfRequired ( Catel.IoC.TypeRequestInfo typeRequestInfoForTypeJustConstructed ) : void

Completes the type request path by checking if the currently created type is the same as the first type meaning that the type is successfully created and the current type request path can be set to null.

CountSpecialObjects ( ConstructorInfo constructor ) : int

Gets the special objects count for the specific constructor.

CreateInstanceWithSpecifiedParameters ( Type typeToConstruct, object tag, object parameters, bool autoCompleteDependencies, bool preventCircularDependencies = true ) : object

Creates an instance of the specified type using the specified parameters as injection values.

GetConstructorCache ( bool autoCompleteDependencies ) : ConstructorInfo>.Dictionary

Gets the constructor cache depending on whether the dependencies should be auto completed.

GetTypeMetaData ( Type type ) : TypeMetaData

Gets the constructors metadata.

InitializeAfterConstruction ( object obj ) : void

Initializes the created object after its construction.

IsValidParameterValue ( Type parameterType, object parameterValue ) : bool

Determines whether the specified parameter value can be used for the specified parameter type.

OnAssemblyLoaded ( object sender, AssemblyLoadedEventArgs e ) : void

Called when the TypeCache.AssemblyLoaded event occurs.

OnServiceLocatorTypeRegistered ( object sender, Catel.IoC.TypeRegisteredEventArgs eventArgs ) : void

Called when the IServiceLocator.TypeRegistered event occurs.

TryCreateToConstruct ( Type typeToConstruct, ConstructorInfo constructor, object tag, object parameters, bool checkConstructor, bool hasMoreConstructorsLeft ) : object

Tries to create the service with the specified constructor using the specified parameters. This method will not throw an exception when the invocation fails.

Note that this method does not require an implementation of TypeRequestPath because this already has the parameter values and thus cannot lead to invalid circular dependencies.

TypeFactory ( ) : System

메소드 상세

ClearCache() 공개 메소드

Clears the cache of all constructors. This call is normally not necessary since the type factory should keep an eye on the IServiceLocator.TypeRegistered event to invalidate the cache.
public ClearCache ( ) : void
리턴 void

CreateInstance() 공개 메소드

Creates an instance of the specified type using dependency injection.
The is null.
public CreateInstance ( Type typeToConstruct ) : object
typeToConstruct System.Type The type to construct.
리턴 object

CreateInstanceWithParameters() 공개 메소드

Creates an instance of the specified type using the specified parameters as injection values.
The is null.
public CreateInstanceWithParameters ( Type typeToConstruct ) : object
typeToConstruct System.Type The type to construct.
리턴 object

CreateInstanceWithParametersAndAutoCompletion() 공개 메소드

Creates an instance of the specified type using the specified parameters as injection values. This method will also auto-complete any additional dependencies that can be resolved from the IServiceLocator.
The is null.
public CreateInstanceWithParametersAndAutoCompletion ( Type typeToConstruct ) : object
typeToConstruct System.Type The type to construct.
리턴 object

CreateInstanceWithParametersAndAutoCompletionWithTag() 공개 메소드

Creates an instance of the specified type using the specified parameters as injection values. This method will also auto-complete any additional dependencies that can be resolved from the IServiceLocator.
The is null.
public CreateInstanceWithParametersAndAutoCompletionWithTag ( Type typeToConstruct, object tag ) : object
typeToConstruct System.Type The type to construct.
tag object The preferred tag when resolving dependencies.
리턴 object

CreateInstanceWithParametersWithTag() 공개 메소드

Creates an instance of the specified type using the specified parameters as injection values.
The is null.
public CreateInstanceWithParametersWithTag ( Type typeToConstruct, object tag ) : object
typeToConstruct System.Type The type to construct.
tag object The preferred tag when resolving dependencies.
리턴 object

CreateInstanceWithTag() 공개 메소드

Creates an instance of the specified type using dependency injection.
The is null.
public CreateInstanceWithTag ( Type typeToConstruct, object tag ) : object
typeToConstruct System.Type The type to construct.
tag object The preferred tag when resolving dependencies.
리턴 object

TypeFactory() 공개 메소드

Initializes a new instance of the TypeFactory class.
The is null.
public TypeFactory ( IServiceLocator serviceLocator ) : System
serviceLocator IServiceLocator The service locator.
리턴 System