C# Class Shaspect.Builder.InitClassGenerator

Generates Shaspect.Implementation.AspectsCollection class, which initializes all aspects in the target assembly. The code is generated using IL and is equivalent of: namespace Shaspect.Implementation { [CompilerGenerated] [DebuggerNonUserCode] internal static class AspectsCollection { public static readonly SimpleAspect Aspect_0; public static readonly ComplexAspect Aspect_1; ... static AspectsCollection() { Aspect_0 = new SimpleAspect (param1, param2, param3); Aspect_0.Prop1 = val1; Aspect_0.Prop2 = val2; Aspect_1 = new ComplexAspect (param1, param2); ... } } }
ファイルを表示 Open project: mshmelev/Shaspect Class Usage Examples

Public Methods

Method Description
BuildAspectInitCode ( Mono.Cecil.MethodDefinition method, CustomAttribute aspect, FieldDefinition &aspectInstanceField, FieldDefinition &methodInfoField ) : void
FinalizeBuilding ( ) : void
InitClassGenerator ( AssemblyDefinition assembly ) : System
IsInitClassCreated ( AssemblyDefinition assembly ) : bool

Private Methods

Method Description
AddInitArrayCode ( TypeReference type, Array value ) : Mono.Cecil.Cil.VariableDefinition
CreateAspectInstance ( CustomAttribute aspect ) : Mono.Cecil.Cil.VariableDefinition
CreateAspectsCollectionClass ( ) : void
InitAspectFields ( CustomAttribute aspect, Mono.Cecil.Cil.VariableDefinition aspectInstanceVar ) : void
InitAspectProperties ( CustomAttribute aspect, Mono.Cecil.Cil.VariableDefinition aspectInstanceVar ) : void

Method Details

BuildAspectInitCode() public method

public BuildAspectInitCode ( Mono.Cecil.MethodDefinition method, CustomAttribute aspect, FieldDefinition &aspectInstanceField, FieldDefinition &methodInfoField ) : void
method Mono.Cecil.MethodDefinition
aspect CustomAttribute
aspectInstanceField Mono.Cecil.FieldDefinition
methodInfoField Mono.Cecil.FieldDefinition
return void

FinalizeBuilding() public method

public FinalizeBuilding ( ) : void
return void

InitClassGenerator() public method

public InitClassGenerator ( AssemblyDefinition assembly ) : System
assembly Mono.Cecil.AssemblyDefinition
return System

IsInitClassCreated() public static method

public static IsInitClassCreated ( AssemblyDefinition assembly ) : bool
assembly Mono.Cecil.AssemblyDefinition
return bool