C# Class Hiro.ContainerCompiler

A class that compile a dependency graph into an inversion of control container.
Inheritance: IContainerCompiler
显示文件 Open project: philiplaureano/Hiro Class Usage Examples

Public Methods

Method Description
Compile ( string typeName, string namespaceName, string assemblyName, IDependencyContainer dependencyContainer ) : AssemblyDefinition

Compiles a dependency graph into an IOC container.

ContainerCompiler ( ) : System

Initializes a new instance of the ContainerCompiler class.

ContainerCompiler ( IGetInstanceMethodImplementor getInstanceMethodImplementor, IContainsMethodImplementor containsMethodImplementor, ICreateContainerType createContainerType, IServiceMapBuilder serviceMapBuilder, IGetAllInstancesMethodImplementor getAllInstancesMethodImplementor ) : System

Initializes a new instance of the ContainerCompiler class.

Private Methods

Method Description
AddInitializationMap ( Mono.Cecil.TypeDefinition containerType, Mono.Cecil.ModuleDefinition module, FieldBuilder fieldEmitter ) : void

Modifies the default constructor to initialize the "__initializedServices" field so that it can ensure that all services called with the IInitialize.Initialize are initialized once per object lifetime.

AddJumpEntries ( Mono.Cecil.ModuleDefinition module, FieldDefinition jumpTargetField, Mono.Cecil.TypeDefinition targetType, MethodReference getServiceHash, IImplementation>.IDictionary serviceMap, int>.IDictionary jumpTargets ) : void

Modifies the default constructor of a container type so that the jump labels used in the IMicroContainer.GetInstance implementation will be precalculated every time the compiled container is instantiated.

InitializeContainerPlugins ( Mono.Cecil.ModuleDefinition module, IDependencyContainer dependencyContainer, Mono.Cecil.Cil.ILProcessor il ) : void

Emits the instructions that introduce the IContainerPlugin instances to the current IMicroContainer instance.

RemoveLastInstruction ( Mono body ) : void

Removes the last instruction from the given method body.

Method Details

Compile() public method

Compiles a dependency graph into an IOC container.
public Compile ( string typeName, string namespaceName, string assemblyName, IDependencyContainer dependencyContainer ) : AssemblyDefinition
typeName string The name of the type.
namespaceName string The namespace name that will be associated with the container type.
assemblyName string The name of the assembly that will contain the container type.
dependencyContainer IDependencyContainer The instance that contains the services that will be instantiated by compiled container.
return Mono.Cecil.AssemblyDefinition

ContainerCompiler() public method

Initializes a new instance of the ContainerCompiler class.
public ContainerCompiler ( ) : System
return System

ContainerCompiler() public method

Initializes a new instance of the ContainerCompiler class.
public ContainerCompiler ( IGetInstanceMethodImplementor getInstanceMethodImplementor, IContainsMethodImplementor containsMethodImplementor, ICreateContainerType createContainerType, IServiceMapBuilder serviceMapBuilder, IGetAllInstancesMethodImplementor getAllInstancesMethodImplementor ) : System
getInstanceMethodImplementor IGetInstanceMethodImplementor The class that will implement the GetInstance method.
containsMethodImplementor IContainsMethodImplementor The class that will implement the Contains method.
createContainerType ICreateContainerType The class that will define the container type.
serviceMapBuilder IServiceMapBuilder The class that will define the service map.
getAllInstancesMethodImplementor IGetAllInstancesMethodImplementor The class that will implement the GetAllInstances method.
return System