Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

DynamicCodeManager Class

Use this class for obtaining ModuleBuilder instances for dynamic code generation.

For a list of all members of this type, see DynamicCodeManager Members .

System.Object
   DynamicCodeManager

[Visual Basic]
Public NotInheritable Class DynamicCodeManager
[C#]
public sealed class DynamicCodeManager

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The purpose of this class is to provide a simple abstraction for creating and managing dynamic assemblies.

Note    Using this factory you can't define several modules within a single dynamic assembly - only a simple one2one relation between assembly/module is used.

Example

The following excerpt from DynamicProxyManager demonstrates usage:

 public class DynamicProxyManager
 {
   public const string PROXY_ASSEMBLY_NAME = "Spring.Proxy";

   public static TypeBuilder CreateTypeBuilder(string name, Type baseType)
   {
     // Generates type name
     string typeName = String.Format("{0}.{1}_{2}", PROXY_ASSEMBLY_NAME, name, Guid.NewGuid().ToString("N"));
     ModuleBuilder module = DynamicCodeManager.GetModuleBuilder(PROXY_ASSEMBLY_NAME);
     return module.DefineType(typeName, PROXY_TYPE_ATTRIBUTES);
   }
 }
 

Requirements

Namespace: Spring.Util

Assembly: Spring.Core (in Spring.Core.dll)

See Also

DynamicCodeManager Members | Spring.Util Namespace | DynamicReflectionManager | DynamicProxyManager | MethodInjectingInstantiationStrategy