C# Class Composite.Core.Types.CodeGenerationManager

Handles all dynamic type compilations and the generation of Composite.Generated.dll
Show file Open project: Orckestra/C1-CMS

Private Properties

Property Type Description
AddCompiledAssembly void
ClearOldTempFiles void
CodeGenerationManager System
Compile void
Flush void
LoadAssembliesToMemory Exception>>.ICollection
PopulateBuilder void
ValidateCompositeGenerate void

Public Methods

Method Description
AddAssemblyCodeProvider ( ICodeProvider codeProvider ) : void

Use this method to add a ICodeProvider implementation that will be used when (and only) generating the final Composite.Generated.dll.

CompileRuntimeTempTypes ( Composite.Core.Types.CodeGenerationBuilder codeGenerationBuilder, bool verbose = true ) : IEnumerable

This method will compile the type defined in codeGenerationBuilder and return the result types. These types exists in a temp assembly, that will be deleted when the app domain is terminated.

GenerateCompositeGeneratedAssembly ( bool forceGeneration = false ) : void

This method will recompile Composite.Generated.dll and drop it into bin.

GetCompiledType ( string fullName ) : Type

Gets the compiled types.

IsCompiledAtRuntime ( Type type ) : bool

This method returns true if the given type type is compiled at runetime. Otherwise false.

IsRecompileNeeded ( Type dependableType, IEnumerable dependingTypes ) : bool

This method returns true if the types given by dependingTypes needs a recompile because they either is null or the type given by dependableType has changed and there for exists in a compiled at runtime assembly.

Private Methods

Method Description
AddCompiledAssembly ( Assembly newAssembly ) : void
ClearOldTempFiles ( ) : void
CodeGenerationManager ( ) : System
Compile ( Composite.Core.Types.CodeGenerationBuilder builder ) : void
Flush ( ) : void
LoadAssembliesToMemory ( StringCollection assemblyLocations ) : Exception>>.ICollection
PopulateBuilder ( Composite.Core.Types.CodeGenerationBuilder builder ) : void
ValidateCompositeGenerate ( System.DateTime time ) : void

Validates that the current Composite.Generated.dll is not compiled after the given time. If it is compiled after the given time. Any attempts to recompile Composite.Generated.dll will be ignored. This is used to stop app domains from shutting each other down by recompiles.

Method Details

AddAssemblyCodeProvider() public static method

Use this method to add a ICodeProvider implementation that will be used when (and only) generating the final Composite.Generated.dll.
public static AddAssemblyCodeProvider ( ICodeProvider codeProvider ) : void
codeProvider ICodeProvider
return void

CompileRuntimeTempTypes() public static method

This method will compile the type defined in codeGenerationBuilder and return the result types. These types exists in a temp assembly, that will be deleted when the app domain is terminated.
public static CompileRuntimeTempTypes ( Composite.Core.Types.CodeGenerationBuilder codeGenerationBuilder, bool verbose = true ) : IEnumerable
codeGenerationBuilder Composite.Core.Types.CodeGenerationBuilder
verbose bool
return IEnumerable

GenerateCompositeGeneratedAssembly() public static method

This method will recompile Composite.Generated.dll and drop it into bin.
public static GenerateCompositeGeneratedAssembly ( bool forceGeneration = false ) : void
forceGeneration bool
return void

GetCompiledType() public static method

Gets the compiled types.
public static GetCompiledType ( string fullName ) : Type
fullName string
return System.Type

IsCompiledAtRuntime() public static method

This method returns true if the given type type is compiled at runetime. Otherwise false.
public static IsCompiledAtRuntime ( Type type ) : bool
type System.Type
return bool

IsRecompileNeeded() public static method

This method returns true if the types given by dependingTypes needs a recompile because they either is null or the type given by dependableType has changed and there for exists in a compiled at runtime assembly.
public static IsRecompileNeeded ( Type dependableType, IEnumerable dependingTypes ) : bool
dependableType System.Type A type that all the types given by depends on.
dependingTypes IEnumerable All types in this enumerable should either be null or depend on the typoe given by
return bool