public static ModuleBuilder CreateModule(Action<AssemblySpecification> assemblySpecificationExpression)
        {
            var assemblySpec = new AssemblySpecification();
            assemblySpecificationExpression(assemblySpec);

            AssemblyBuilder assemblyBuilder = CreateAssembly(assemblySpec);

            foreach (var assemblyAttribute in assemblySpec.AttributeSpecification)
            {
                assemblyBuilder.AddAttribute(assemblyAttribute.GetType());
            }

            return assemblyBuilder.DefineDynamicModule(assemblySpec.Name, assemblySpec.Name + ".dll");
        }
예제 #2
0
        public static ModuleBuilder CreateModule(Action <AssemblySpecification> assemblySpecificationExpression)
        {
            var assemblySpec = new AssemblySpecification();

            assemblySpecificationExpression(assemblySpec);

            AssemblyBuilder assemblyBuilder = CreateAssembly(assemblySpec);

            foreach (var assemblyAttribute in assemblySpec.AttributeSpecification)
            {
                assemblyBuilder.AddAttribute(assemblyAttribute.GetType());
            }

            return(assemblyBuilder.DefineDynamicModule(assemblySpec.Name, assemblySpec.Name + ".dll"));
        }
예제 #3
0
 private static AssemblyBuilder CreateAssembly(AssemblySpecification assemblySpec)
 {
     return(AppDomain.CurrentDomain.DefineDynamicAssembly(
                new AssemblyName(assemblySpec.Name),
                AssemblyBuilderAccess.RunAndSave));
 }
 private static AssemblyBuilder CreateAssembly(AssemblySpecification assemblySpec)
 {
     return AppDomain.CurrentDomain.DefineDynamicAssembly(
         new AssemblyName(assemblySpec.Name),
         AssemblyBuilderAccess.RunAndSave);
 }