Esempio n. 1
0
        public IModuleBuilder CreateModuleBuilder(string assemblyName, string assemblyDirectoryOrNull, bool strongNamed, string keyFilePathOrNull)
        {
            ArgumentUtility.CheckNotNullOrEmpty("assemblyName", assemblyName);

            var moduleBuilder = _moduleBuilderFactory.CreateModuleBuilder(assemblyName, assemblyDirectoryOrNull, strongNamed, keyFilePathOrNull);

            var attribute = new CustomAttributeDeclaration(s_nonApplicationAssemblyAttributeConstructor, new object[0]);

            moduleBuilder.AssemblyBuilder.SetCustomAttribute(attribute);

            return(moduleBuilder);
        }
        public ITypeBuilder DefineType(string name, TypeAttributes attributes, IEmittableOperandProvider emittableOperandProvider)
        {
            ArgumentUtility.CheckNotNullOrEmpty("name", name);
            ArgumentUtility.CheckNotNull("emittableOperandProvider", emittableOperandProvider);

            if (_moduleContext.ModuleBuilder == null)
            {
                var assemblyName = GetNextAssemblyName();
                _moduleContext.ModuleBuilder = _moduleBuilderFactory.CreateModuleBuilder(assemblyName, _assemblyDirectory, _forceStrongNaming, _keyFilePath);
            }

            var typeBuilder = _moduleContext.ModuleBuilder.DefineType(name, attributes);

            return(new TypeBuilderDecorator(typeBuilder, emittableOperandProvider));
        }