/// <summary>
 /// Invokes all ICodeDecorator(s) in the decorators collection.
 /// </summary>
 public void ApplyDecorations(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
 {
     foreach (ICodeDecorator decorator in decorators)
     {
         decorator.Decorate(code, options);
     }
 }
 /// <summary>
 /// Invokes all ICodeDecorator(s) in the decorators collection.
 /// </summary>
 public void ApplyDecorations(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
 {
     foreach (ICodeDecorator decorator in decorators)
     {
         decorator.Decorate(code, options);
     }
 }
        /// <summary>
        /// Invokes all ICodeDecorator(s) in the decorators collection.
        /// </summary>
        public void ApplyDecorations(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            //string fileName = "C:\\Users\\rs239\\Documents\\NIEM\\temp\\Decorators.txt";
            //StringWriter stringWriter = new StringWriter();

            //stringWriter.WriteLine("Namespace = " + codeNamespace.Name);

            //stringWriter.WriteLine("___________________________________________");
            //stringWriter.WriteLine(ctd.Name);

            //FileStream fs = File.Open(fileName, FileMode.Create, FileAccess.Write, FileShare.None);
            //StreamWriter writer = new StreamWriter(fs);
            //writer.Write(stringWriter);
            //writer.Flush();
            
            foreach (ICodeDecorator decorator in decorators)
            {
                IMetadata metadataDecorator = decorator as IMetadata;
                if (metadataDecorator != null)
                {
                    metadataDecorator.MetadataSet = this.metadataSet;
                }

                decorator.Decorate(code, options);
            }
        }
 public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
 {
     if (options.GenerateCollections)
     {
         CollectionTypeGenerator generator = new CollectionTypeGenerator(new CollectionTypeProvider(), code);
         generator.Execute();
     }
 }
 public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
 {
     if (options.GenerateTypedLists)
     {
         CollectionTypeGenerator generator = new CollectionTypeGenerator(new ListTypeProvider(), code);
         generator.Execute();
     }
 }
 public InternalCodeGenerationOptions(MetadataResolverOptions metadataResolverOptions, PrimaryCodeGenerationOptions primaryOptions, CustomCodeGenerationOptions customOptions, CodeWriterOptions writerOptions, CodeGenerationOptions allOptions)
 {
     this.metadataResolverOptions = metadataResolverOptions;
     this.primaryOptions = primaryOptions;
     this.customOptions = customOptions;
     this.writerOptions = writerOptions;
     this.allOptions = allOptions;
 }
Exemple #7
0
 public InternalCodeGenerationOptions(MetadataResolverOptions metadataResolverOptions, PrimaryCodeGenerationOptions primaryOptions, CustomCodeGenerationOptions customOptions, CodeWriterOptions writerOptions, CodeGenerationOptions allOptions)
 {
     this.metadataResolverOptions = metadataResolverOptions;
     this.primaryOptions          = primaryOptions;
     this.customOptions           = customOptions;
     this.writerOptions           = writerOptions;
     this.allOptions = allOptions;
 }
Exemple #8
0
        /// <summary>
        /// Parses the code generation options specified by options parameter and returns an instance of
        /// InternalCodeGenearationOptions type.
        /// </summary>
        public static InternalCodeGenerationOptions ParseCodeGenerationOptions(CodeGenerationOptions options)
        {
            MetadataResolverOptions      resolverOptions = GetMetadataResolverOptions(options);
            PrimaryCodeGenerationOptions primaryOptions  = GetPrimaryCodeGenerationOptions(options);
            CustomCodeGenerationOptions  customOptions   = GetCustomCodeGenerationOptions(options);
            CodeWriterOptions            writerOptions   = GetCodeWriterOptions(options);

            InternalCodeGenerationOptions icgo = new InternalCodeGenerationOptions(resolverOptions, primaryOptions, customOptions, writerOptions, options);

            return(icgo);
        }
        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            // Some validations to make debugging easier.
            Debug.Assert(code != null, "code parameter could not be null.");
            Debug.Assert(options != null, "options parameter could not be null.");

            // We execute this decorator only if we are generating the service side code.
            if (options.GenerateService)
            {
                // Initialize the state.
                this.code = code;
                this.options = options;
                CreateServiceType();                
            }
        }
Exemple #10
0
        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            // Notify if we get any null references.
            Debug.Assert(code != null, "code parameter could not be null.");
            Debug.Assert(options != null, "options parameter could not be null.");

            // We apply this decorator only if this option is turned on.
            if (options.AdjustCasing)
            {
                // Initialize the state.
                this.code    = code;
                this.options = options;
                DecorateInternal();
            }
        }
        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            // Notify if we get any null references.
            Debug.Assert(code != null, "code parameter could not be null.");
            Debug.Assert(options != null, "options parameter could not be null.");

            // We apply this decorator only if this option is turned on.
            if (options.AdjustCasing)
            {
                // Initialize the state.
                this.code = code;
                this.options = options;
                DecorateInternal();
            }
        }
Exemple #12
0
        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            // Some validations to make debugging easier.
            Debug.Assert(code != null, "code parameter could not be null.");
            Debug.Assert(options != null, "options parameter could not be null.");

            // We execute this decorator only if we are generating the service side code.
            if (options.GenerateService)
            {
                // Initialize the state.
                this.code    = code;
                this.options = options;
                CreateServiceType();
            }
        }
Exemple #13
0
        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            this.code          = code;
            this.options       = options;
            this.configuration = code.Configuration;

            // Are we on the service side code gen?
            if (options.GenerateService)
            {
                // Then generate the service side configuration.
                GenerateServiceConfiguration();

                // Do we have to enable metadata endpoint?
                if (options.EnableWsdlEndpoint)
                {
                    AddMetadataServiceBehavior();
                }
            }
        }
        // Filters the custom code generation options.
        private static CustomCodeGenerationOptions GetCustomCodeGenerationOptions(CodeGenerationOptions options)
        {
            CustomCodeGenerationOptions customOptions = new CustomCodeGenerationOptions();
        	customOptions.FormatSoapActions = options.FormatSoapActions;
            customOptions.AdjustCasing = options.AdjustCasing;
            customOptions.GenerateCollections = options.GenerateCollections;
            customOptions.GenerateService = options.GenerateService;
            customOptions.GenerateTypedLists = options.GenerateTypedLists;
            customOptions.ClrNamespace = options.ClrNamespace;
            customOptions.EnableWsdlEndpoint = options.EnableWsdlEndpoint;
        	customOptions.GenerateSvcFile = options.GenerateSvcFile;
            customOptions.MetadataLocation = options.MetadataLocation;
        	customOptions.ConcurrencyMode = options.ConcurrencyMode;
        	customOptions.InstanceContextMode = options.InstanceContextMode;
        	customOptions.UseSynchronizationContext = options.UseSynchronizationContext;
			customOptions.MethodImplementation = options.MethodImplementation;

            return customOptions;
        }
Exemple #15
0
        public void Decorate(ExtendedCodeDomTree code, CustomCodeGenerationOptions options)
        {
            this.code = code;
            this.options = options;
            this.configuration = code.Configuration;

            // Are we on the service side code gen?
            if (options.GenerateService)
            {
                // Then generate the service side configuration.
                GenerateServiceConfiguration();

                // Do we have to enable metadata endpoint?
                if (options.EnableWsdlEndpoint)
                {
                    AddMetadataServiceBehavior();
                }
            }
        }
        // Filters the custom code generation options.
        private static CustomCodeGenerationOptions GetCustomCodeGenerationOptions(CodeGenerationOptions options)
        {
            CustomCodeGenerationOptions customOptions = new CustomCodeGenerationOptions();

            customOptions.FormatSoapActions         = options.FormatSoapActions;
            customOptions.AdjustCasing              = options.AdjustCasing;
            customOptions.GenerateCollections       = options.GenerateCollections;
            customOptions.GenerateService           = options.GenerateService;
            customOptions.GenerateTypedLists        = options.GenerateTypedLists;
            customOptions.ClrNamespace              = options.ClrNamespace;
            customOptions.EnableWsdlEndpoint        = options.EnableWsdlEndpoint;
            customOptions.GenerateSvcFile           = options.GenerateSvcFile;
            customOptions.MetadataLocation          = options.MetadataLocation;
            customOptions.ConcurrencyMode           = options.ConcurrencyMode;
            customOptions.InstanceContextMode       = options.InstanceContextMode;
            customOptions.UseSynchronizationContext = options.UseSynchronizationContext;
            customOptions.MethodImplementation      = options.MethodImplementation;

            return(customOptions);
        }