Thinktecture.Tools.Web.Services.CodeGeneration.CodeWriter.CreateCodeGeneratorOptions C# (CSharp) Method

CreateCodeGeneratorOptions() private static method

This is a helper method to create an instance of CodeGeneratorOptions class with desired code generation options.
private static CreateCodeGeneratorOptions ( ) : CodeGeneratorOptions
return System.CodeDom.Compiler.CodeGeneratorOptions
        private static CodeGeneratorOptions CreateCodeGeneratorOptions()
        {
            // Create and instance of CodeGeneratorOptions class.
            CodeGeneratorOptions options = new CodeGeneratorOptions();
            // Set the bracing style to "C". This will make sure that braces start on the line following
            // the statement or declaration that they are associated with.
            options.BracingStyle = "C";
            // Finally return the CodeGeneratorOptions class instance.
            return options;
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Writes the code to the disk according to the given options.
        /// </summary>
        private void WriteCodeFiles()
        {
            // Ensure the output directory exist in the file system.
            EnsureDirectoryExists(options.OutputLocation);

            // Create the CodeGenerationOptions instance.
            codeGenerationOptions = CodeWriter.CreateCodeGeneratorOptions();

            // Do we have to generate separate files?
            if (options.GenerateSeparateFiles)
            {
                // Write the code into separate files.
                WriteSeparateCodeFiles();
            }
            else
            {
                // Write the code into a singl file.
                WriteSingleCodeFile();
            }

            // Finally write the configuration file.
            if (configuration != null)
            {
                WriteConfigurationFile();
            }
            WriteTextFiles();
        }