当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyBuilder.DefineDynamicModule方法代码示例

本文整理汇总了C#中System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyBuilder.DefineDynamicModule方法的具体用法?C# AssemblyBuilder.DefineDynamicModule怎么用?C# AssemblyBuilder.DefineDynamicModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.Emit.AssemblyBuilder的用法示例。


在下文中一共展示了AssemblyBuilder.DefineDynamicModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssemblyEmitter

		public AssemblyEmitter( string assemblyName, bool canSave )
		{
			m_AssemblyName = assemblyName;

			m_AppDomain = AppDomain.CurrentDomain;

			m_AssemblyBuilder = m_AppDomain.DefineDynamicAssembly(
				new AssemblyName( assemblyName ),
				canSave ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run
			);

			if ( canSave )
			{
				m_ModuleBuilder = m_AssemblyBuilder.DefineDynamicModule(
					assemblyName,
					String.Format( "{0}.dll", assemblyName.ToLower() ),
					false
				);
			}
			else
			{
				m_ModuleBuilder = m_AssemblyBuilder.DefineDynamicModule(
					assemblyName,
					false
				);
			}
		}
开发者ID:nick12344356,项目名称:The-Basement,代码行数:27,代码来源:Emitter.cs

示例2: DefineDynamicModule

		public ModuleBuilder DefineDynamicModule(AssemblyBuilder assemblyBuilder, string moduleName)
		{
#if DEBUG
			ModuleBuilder moduleBuilder =
				assemblyBuilder.DefineDynamicModule(moduleName, string.Format("{0}.mod", moduleName), true);
#else
			ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName);
#endif
			return moduleBuilder;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:DefaultProxyAssemblyBuilder.cs

示例3: AssemblyBuilder

        public AssemblyBuilder(bool canSave)
        {
            _canSave = canSave;
            _name = "EnigmaDynamicEmit." + Guid.NewGuid().ToString("N");

            var domain = AppDomain.CurrentDomain;
            _assemblyBuilder = domain.DefineDynamicAssembly(new AssemblyName(_name), canSave ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run);
            _module = canSave
                ? _assemblyBuilder.DefineDynamicModule(_name, _name + ".dll")
                : _assemblyBuilder.DefineDynamicModule(_name);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:11,代码来源:AssemblyBuilder.cs

示例4: ProjectionAssembly

        public ProjectionAssembly(string name, ProjectionOptions options)
        {
            this.name = name;

            assembly = AppDomain.CurrentDomain.DefineDynamicAssembly
            (
                new AssemblyName(name),
                GetAssemblyAccess(options)
            );

            module = 0 == (options & ProjectionOptions.SaveAssemblies)
                ? assembly.DefineDynamicModule(name)
                : assembly.DefineDynamicModule(name, FileName);
        }
开发者ID:sharpjs,项目名称:Projector,代码行数:14,代码来源:ProjectionAssembly.cs

示例5: RuntimeDynamicModule

 public RuntimeDynamicModule()
 {
     _assemblyName = new AssemblyName(DEFAULT_MODULE_NAME);
     _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(_assemblyName,
         AssemblyBuilderAccess.RunAndSave);
     _moduleBuilder = _assemblyBuilder.DefineDynamicModule(DEFAULT_MODULE_NAME, DEFAULT_MODULE_NAME + ".dll");
 }
开发者ID:FarseerNet,项目名称:Farseer.Net.DI,代码行数:7,代码来源:DynamicModule.cs

示例6: WrapFactory

 /// <summary>
 /// A static constructor.
 /// </summary>
 static WrapFactory()
 {
     AssemblyName asmName = new AssemblyName();
     asmName.Name = "SqlWrapperDynamicAsm";
     m_asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(asmName, AssemblyBuilderAccess.RunAndSave);
     m_modBuilder = m_asmBuilder.DefineDynamicModule("SqlWrapperDynamicModule");
 }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:10,代码来源:WrapFactory.cs

示例7: ObjCMethod

 static ObjCMethod()
 {
     AssemblyName name = new AssemblyName ();
     name.Name = "MethodProxies";
     builder = AppDomain.CurrentDomain.DefineDynamicAssembly (name, AssemblyBuilderAccess.Run, null, null, null, null, null, true);
     module = builder.DefineDynamicModule ("Proxies");
 }
开发者ID:mono,项目名称:cocoa-sharp,代码行数:7,代码来源:ObjCMethod.cs

示例8: SetAccessorFactory

         /// <summary>
        /// Initializes a new instance of the <see cref="SetAccessorFactory"/> class.
        /// </summary>
        /// <param name="allowCodeGeneration">if set to <c>true</c> [allow code generation].</param>
        public SetAccessorFactory(bool allowCodeGeneration)
		{
            if (allowCodeGeneration)
            {
                // Detect runtime environment and create the appropriate factory
                if (Environment.Version.Major >= 2)
                {
                    _createPropertySetAccessor = new CreatePropertySetAccessor(CreateDynamicPropertySetAccessor);
                    _createFieldSetAccessor = new CreateFieldSetAccessor(CreateDynamicFieldSetAccessor);
                }
                else
                {
                    AssemblyName assemblyName = new AssemblyName();
                    assemblyName.Name = "iBATIS.FastSetAccessor" + HashCodeProvider.GetIdentityHashCode(this);

                    // Create a new assembly with one module
                    _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
                    _moduleBuilder = _assemblyBuilder.DefineDynamicModule(assemblyName.Name + ".dll");

                    _createPropertySetAccessor = new CreatePropertySetAccessor(CreatePropertyAccessor);
                    _createFieldSetAccessor = new CreateFieldSetAccessor(CreateFieldAccessor);
                }
            }
            else
            {
                _createPropertySetAccessor = new CreatePropertySetAccessor(CreateReflectionPropertySetAccessor);
                _createFieldSetAccessor = new CreateFieldSetAccessor(CreateReflectionFieldSetAccessor);
            }
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:33,代码来源:SetAccessorFactory.cs

示例9: NativeDelegateServices

 static NativeDelegateServices()
 {
     var name = new AssemblyName {Name = "NativeDelegateWrapperAssembly"};
     asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
     moduleBuilder = asmBuilder.DefineDynamicModule("NativeDelegateWrapperModule");
     wrapperCache = new Dictionary<KeyValuePair<Type, IntPtr>, Type>();
 }
开发者ID:robert-j,项目名称:Mono.Embedding,代码行数:7,代码来源:NativeDelegateServices.cs

示例10: DynamicAssemblyManager

        static DynamicAssemblyManager()
        {
#if !SILVERLIGHT
            assemblyName = new AssemblyName("NLiteDynamicAssembly");
            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                assemblyName,
                AssemblyBuilderAccess.RunAndSave
                );

            moduleBuilder = assemblyBuilder.DefineDynamicModule(
                assemblyName.Name,
                assemblyName.Name + ".dll",
                true);

            Module = assemblyBuilder.GetModules().FirstOrDefault();
           
#else
            assemblyName = new AssemblyName("EmitMapperAssembly.SL");
            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                  assemblyName,
                  AssemblyBuilderAccess.Run
                  );
            moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, true);
#endif
        }
开发者ID:netcasewqs,项目名称:nlite,代码行数:25,代码来源:DynamicAssemblyManager.cs

示例11: GenContext

 public GenContext(string assyName, string directory, CompilerMode mode)
 {
     AssemblyName aname = new AssemblyName(assyName);
     _assyBldr = AppDomain.CurrentDomain.DefineDynamicAssembly(aname, AssemblyBuilderAccess.RunAndSave,directory);
     _moduleBldr = _assyBldr.DefineDynamicModule(aname.Name, aname.Name + ".dll", true);
     _mode = mode;
 }
开发者ID:kmartin,项目名称:clojure-contrib,代码行数:7,代码来源:GenContext.cs

示例12: CreateAssembly

 private void CreateAssembly()
 {  //to create an assembly programmatically
     AssemblyName Name = new AssemblyName("NaiveORM0Classes");
     AppDomain Domain = Thread.GetDomain();
     _Builder = Domain.DefineDynamicAssembly(Name, AssemblyBuilderAccess.Run);
     _Module = _Builder.DefineDynamicModule("NaiveORM0ClassesM");
 }
开发者ID:fabm22,项目名称:NaiveORM,代码行数:7,代码来源:ClassManager.cs

示例13: DynamicAssembly

        public DynamicAssembly()
        {
            int assemblyNumber = Interlocked.Increment(ref _assemblyCount);
            _assemblyName = new AssemblyName {
                Name = String.Format("Quokka.DynamicAssembly.N{0}", assemblyNumber)
            };
            string moduleName = AssemblyName.Name;
            _dynamicClassNamespace = AssemblyName.Name;

            if (CreateFiles)
            {
                _assemblyBuilder = Thread.GetDomain().DefineDynamicAssembly(
                    AssemblyName, AssemblyBuilderAccess.RunAndSave);

                // Add a debuggable attribute to the assembly saying to disable optimizations
                // See http://blogs.msdn.com/rmbyers/archive/2005/06/26/432922.aspx
                Type daType = typeof (DebuggableAttribute);
                ConstructorInfo daCtor = daType.GetConstructor(new[] {typeof (bool), typeof (bool)});
                var daBuilder = new CustomAttributeBuilder(daCtor, new object[] {true, true});
                _assemblyBuilder.SetCustomAttribute(daBuilder);

                _moduleBuilder = _assemblyBuilder.DefineDynamicModule(moduleName);
                _canSave = true;
            }
            else
            {
                _assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess.Run);
                _moduleBuilder = _assemblyBuilder.DefineDynamicModule(moduleName);
            }
        }
开发者ID:jjeffery,项目名称:Cesto,代码行数:30,代码来源:DynamicAssembly.cs

示例14: Reset

 public void Reset()
 {
     UniqueCounter++;
     var CurrentAppDomain = AppDomain.CurrentDomain;
     AssemblyBuilder = CurrentAppDomain.DefineDynamicAssembly(new AssemblyName("assembly" + UniqueCounter), AssemblyBuilderAccess.RunAndSave);
     ModuleBuilder = AssemblyBuilder.DefineDynamicModule("module" + UniqueCounter);
 }
开发者ID:mrcmunir,项目名称:cspspemu,代码行数:7,代码来源:MipsEmiter.cs

示例15: FixtureSetUp

 public void FixtureSetUp()
 {
     //assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.RunAndSave);
     //moduleBuilder = assemblyBuilder.DefineDynamicModule("TestAssembly", "TestAssembly.dll");
     assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.Run);
     moduleBuilder = assemblyBuilder.DefineDynamicModule("TestAssembly");
 }
开发者ID:jeremybeavon,项目名称:LinqCompileToInstanceMethod,代码行数:7,代码来源:LinqExpressionExtensionsTests.cs


注:本文中的System.Reflection.Emit.AssemblyBuilder.DefineDynamicModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。