C# Класс Castle.DynamicProxy.ModuleScope

Summary description for ModuleScope.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DEFAULT_ASSEMBLY_NAME String
DEFAULT_FILE_NAME String

Открытые методы

Метод Описание
DefineType ( bool inSignedModulePreferably, string name, TypeAttributes flags ) : TypeBuilder
GetFromCache ( Castle.DynamicProxy.Generators.CacheKey key ) : Type

Returns a type from this scope's type cache, or null if the key cannot be found.

GetKeyPair ( ) : byte[]

Gets the key pair used to sign the strong-named assembly generated by this ModuleScope.

LoadAssemblyIntoCache ( Assembly assembly ) : void

Loads the generated types from the given assembly into this ModuleScope's cache.

This method can be used to load previously generated and persisted proxy types from disk into this scope's type cache, eg. in order to avoid the performance hit associated with proxy generation.

ModuleScope ( ) : System

Initializes a new instance of the ModuleScope class; assemblies created by this instance will not be saved.

ModuleScope ( bool savePhysicalAssembly ) : System

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved.

ModuleScope ( bool savePhysicalAssembly, bool disableSignedModule ) : System

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved.

ModuleScope ( bool savePhysicalAssembly, bool disableSignedModule, INamingScope namingScope, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath ) : System

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved and what simple names are to be assigned to them.

ModuleScope ( bool savePhysicalAssembly, bool disableSignedModule, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath ) : System

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved and what simple names are to be assigned to them.

ObtainDynamicModule ( bool isStrongNamed ) : ModuleBuilder

Gets the specified module generated by this scope, creating a new one if none has yet been generated.

ObtainDynamicModuleWithStrongName ( ) : ModuleBuilder

Gets the strong-named module generated by this scope, creating a new one if none has yet been generated.

ObtainDynamicModuleWithWeakName ( ) : ModuleBuilder

Gets the weak-named module generated by this scope, creating a new one if none has yet been generated.

RegisterInCache ( Castle.DynamicProxy.Generators.CacheKey key, Type type ) : void

Registers a type in this scope's type cache.

SaveAssembly ( ) : string

Saves the generated assembly with the name and directory information given when this ModuleScope instance was created (or with the DEFAULT_FILE_NAME and current directory if none was given).

This method stores the generated assembly in the directory passed as part of the module information specified when this instance was constructed (if any, else the current directory is used). If both a strong-named and a weak-named assembly have been generated, it will throw an exception; in this case, use the SaveAssembly (bool) overload.

If this ModuleScope was created without indicating that the assembly should be saved, this method does nothing.

SaveAssembly ( bool strongNamed ) : string

Saves the specified generated assembly with the name and directory information given when this instance was created (or with the DEFAULT_FILE_NAME and current directory if none was given).

This method stores the specified generated assembly in the directory passed as part of the module information specified when this instance was constructed (if any, else the current directory is used).

If this ModuleScope was created without indicating that the assembly should be saved, this method does nothing.

Приватные методы

Метод Описание
AddCacheMappings ( AssemblyBuilder builder ) : void
CreateModule ( bool signStrongName ) : ModuleBuilder
GetAssemblyName ( bool signStrongName ) : AssemblyName

Описание методов

DefineType() публичный Метод

public DefineType ( bool inSignedModulePreferably, string name, TypeAttributes flags ) : TypeBuilder
inSignedModulePreferably bool
name string
flags TypeAttributes
Результат System.Reflection.Emit.TypeBuilder

GetFromCache() публичный Метод

Returns a type from this scope's type cache, or null if the key cannot be found.
public GetFromCache ( Castle.DynamicProxy.Generators.CacheKey key ) : Type
key Castle.DynamicProxy.Generators.CacheKey The key to be looked up in the cache.
Результат System.Type

GetKeyPair() публичный статический Метод

Gets the key pair used to sign the strong-named assembly generated by this ModuleScope.
public static GetKeyPair ( ) : byte[]
Результат byte[]

LoadAssemblyIntoCache() публичный Метод

Loads the generated types from the given assembly into this ModuleScope's cache.
This method can be used to load previously generated and persisted proxy types from disk into this scope's type cache, eg. in order to avoid the performance hit associated with proxy generation.
public LoadAssemblyIntoCache ( Assembly assembly ) : void
assembly System.Reflection.Assembly The assembly to load types from. This assembly must have been saved via or /// , or it must have the manually applied.
Результат void

ModuleScope() публичный Метод

Initializes a new instance of the ModuleScope class; assemblies created by this instance will not be saved.
public ModuleScope ( ) : System
Результат System

ModuleScope() публичный Метод

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved.
public ModuleScope ( bool savePhysicalAssembly ) : System
savePhysicalAssembly bool If set to true saves the generated module.
Результат System

ModuleScope() публичный Метод

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved.
public ModuleScope ( bool savePhysicalAssembly, bool disableSignedModule ) : System
savePhysicalAssembly bool If set to true saves the generated module.
disableSignedModule bool If set to true disables ability to generate signed module. This should be used in cases where ran under constrained permissions.
Результат System

ModuleScope() публичный Метод

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved and what simple names are to be assigned to them.
public ModuleScope ( bool savePhysicalAssembly, bool disableSignedModule, INamingScope namingScope, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath ) : System
savePhysicalAssembly bool If set to true saves the generated module.
disableSignedModule bool If set to true disables ability to generate signed module. This should be used in cases where ran under constrained permissions.
namingScope INamingScope Naming scope used to provide unique names to generated types and their members (usually via sub-scopes).
strongAssemblyName string The simple name of the strong-named assembly generated by this .
strongModulePath string The path and file name of the manifest module of the strong-named assembly generated by this .
weakAssemblyName string The simple name of the weak-named assembly generated by this .
weakModulePath string The path and file name of the manifest module of the weak-named assembly generated by this .
Результат System

ModuleScope() публичный Метод

Initializes a new instance of the ModuleScope class, allowing to specify whether the assemblies generated by this instance should be saved and what simple names are to be assigned to them.
public ModuleScope ( bool savePhysicalAssembly, bool disableSignedModule, string strongAssemblyName, string strongModulePath, string weakAssemblyName, string weakModulePath ) : System
savePhysicalAssembly bool If set to true saves the generated module.
disableSignedModule bool If set to true disables ability to generate signed module. This should be used in cases where ran under constrained permissions.
strongAssemblyName string The simple name of the strong-named assembly generated by this .
strongModulePath string The path and file name of the manifest module of the strong-named assembly generated by this .
weakAssemblyName string The simple name of the weak-named assembly generated by this .
weakModulePath string The path and file name of the manifest module of the weak-named assembly generated by this .
Результат System

ObtainDynamicModule() публичный Метод

Gets the specified module generated by this scope, creating a new one if none has yet been generated.
public ObtainDynamicModule ( bool isStrongNamed ) : ModuleBuilder
isStrongNamed bool If set to true, a strong-named module is returned; otherwise, a weak-named module is returned.
Результат System.Reflection.Emit.ModuleBuilder

ObtainDynamicModuleWithStrongName() публичный Метод

Gets the strong-named module generated by this scope, creating a new one if none has yet been generated.
public ObtainDynamicModuleWithStrongName ( ) : ModuleBuilder
Результат System.Reflection.Emit.ModuleBuilder

ObtainDynamicModuleWithWeakName() публичный Метод

Gets the weak-named module generated by this scope, creating a new one if none has yet been generated.
public ObtainDynamicModuleWithWeakName ( ) : ModuleBuilder
Результат System.Reflection.Emit.ModuleBuilder

RegisterInCache() публичный Метод

Registers a type in this scope's type cache.
public RegisterInCache ( Castle.DynamicProxy.Generators.CacheKey key, Type type ) : void
key Castle.DynamicProxy.Generators.CacheKey The key to be associated with the type.
type System.Type The type to be stored in the cache.
Результат void

SaveAssembly() публичный Метод

Saves the generated assembly with the name and directory information given when this ModuleScope instance was created (or with the DEFAULT_FILE_NAME and current directory if none was given).

This method stores the generated assembly in the directory passed as part of the module information specified when this instance was constructed (if any, else the current directory is used). If both a strong-named and a weak-named assembly have been generated, it will throw an exception; in this case, use the SaveAssembly (bool) overload.

If this ModuleScope was created without indicating that the assembly should be saved, this method does nothing.

Both a strong-named and a weak-named assembly have been generated.
public SaveAssembly ( ) : string
Результат string

SaveAssembly() публичный Метод

Saves the specified generated assembly with the name and directory information given when this instance was created (or with the DEFAULT_FILE_NAME and current directory if none was given).

This method stores the specified generated assembly in the directory passed as part of the module information specified when this instance was constructed (if any, else the current directory is used).

If this ModuleScope was created without indicating that the assembly should be saved, this method does nothing.

No assembly has been generated that matches the parameter. ///
public SaveAssembly ( bool strongNamed ) : string
strongNamed bool True if the generated assembly with a strong name should be saved (see ); /// false if the generated assembly without a strong name should be saved (see .
Результат string

Описание свойств

DEFAULT_ASSEMBLY_NAME публичное статическое свойство

The default assembly (simple) name used for the assemblies generated by a ModuleScope instance.
public static String DEFAULT_ASSEMBLY_NAME
Результат String

DEFAULT_FILE_NAME публичное статическое свойство

The default file name used when the assembly is saved using DEFAULT_FILE_NAME.
public static String DEFAULT_FILE_NAME
Результат String