C# Class Hiro.Compilers.SingletonEmitter

Represents the basic implementation of a ISingletonEmitter instance.
Inheritance: ISingletonEmitter
Datei anzeigen Open project: philiplaureano/Hiro

Public Methods

Method Description
EmitService ( Mono.Cecil.MethodDefinition targetMethod, IDependency dependency, IImplementation implementation, IImplementation>.IDictionary serviceMap ) : void

Emits a service as a singleton type.

Protected Methods

Method Description
EmitSingletonInstantiation ( IDependency dependency, IImplementation implementation, IImplementation>.IDictionary serviceMap, FieldDefinition instanceField, Mono.Cecil.MethodDefinition cctor, Mono.Cecil.ModuleDefinition module, Mono.Cecil.MethodDefinition targetMethod ) : void

Defines the instructions that will instantiate the singleton instance itself.

Private Methods

Method Description
AddDefaultSingletonConstructor ( Mono.Cecil.ModuleDefinition module, string singletonName, TypeAttributes typeAttributes, TypeReference objectType ) : Mono.Cecil.TypeDefinition

Adds a default constructor to the singleton type.

DefineGetInstance ( Mono.Cecil.TypeDefinition singletonType, Mono.Cecil.Cil.ILProcessor il, FieldDefinition instanceField ) : Mono.Cecil.MethodDefinition

Defines the factory method on the singleton type.

DefineNestedConstructors ( Mono.Cecil.ModuleDefinition module, Mono.Cecil.TypeDefinition nestedType ) : Mono.Cecil.MethodDefinition

Defines the nested constructors for the singleton type.

DefineNestedType ( Mono.Cecil.ModuleDefinition module, Mono.Cecil.TypeDefinition singletonType, FieldDefinition instanceField, IImplementation>.IDictionary serviceMap, IImplementation implementation, IDependency dependency, Mono.Cecil.MethodDefinition targetMethod ) : void

Defines the nested type that will instantiate the actual singleton service instance.

DefineStaticConstructor ( Mono.Cecil.ModuleDefinition module, Mono.Cecil.TypeDefinition nestedType ) : Mono.Cecil.MethodDefinition

Defines the static constructor for the nested type.

Method Details

EmitService() public method

Emits a service as a singleton type.
public EmitService ( Mono.Cecil.MethodDefinition targetMethod, IDependency dependency, IImplementation implementation, IImplementation>.IDictionary serviceMap ) : void
targetMethod Mono.Cecil.MethodDefinition The method implementation.
dependency IDependency The dependency that will be instantiated by the container.
implementation IImplementation The implementation that will be used to instantiate the dependency.
serviceMap IImplementation>.IDictionary The service map the contains the current application dependencies.
return void

EmitSingletonInstantiation() protected method

Defines the instructions that will instantiate the singleton instance itself.
protected EmitSingletonInstantiation ( IDependency dependency, IImplementation implementation, IImplementation>.IDictionary serviceMap, FieldDefinition instanceField, Mono.Cecil.MethodDefinition cctor, Mono.Cecil.ModuleDefinition module, Mono.Cecil.MethodDefinition targetMethod ) : void
dependency IDependency The dependency that will be instantiated by the singleton.
implementation IImplementation The implementation that will instantiate the dependency.
serviceMap IImplementation>.IDictionary The service map that contains the list of dependencies in the application.
instanceField Mono.Cecil.FieldDefinition The field that will hold the singleton instance.
cctor Mono.Cecil.MethodDefinition The static constructor itself.
module Mono.Cecil.ModuleDefinition The target module.
targetMethod Mono.Cecil.MethodDefinition The target method that will instantiate the service instance.
return void