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; }
/// <summary> /// Private constructor. /// </summary> CodeWriter(CodeNamespace codeNamespace, Configuration configuration, CodeWriterOptions options, List<TextFile> textFiles, CodeDomProvider provider) { // Initialize the state with supplied parameters. this.codeNamespace = codeNamespace; this.configuration = configuration; this.options = options; this.provider = provider; this.textFiles = textFiles; }
/// <summary> /// Private constructor. /// </summary> CodeWriter(CodeNamespace codeNamespace, Configuration configuration, CodeWriterOptions options, List <TextFile> textFiles, CodeDomProvider provider) { // Initialize the state with supplied parameters. this.codeNamespace = codeNamespace; this.configuration = configuration; this.options = options; this.provider = provider; this.textFiles = textFiles; }
/// <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); }
/// <summary> /// Generates the code using the appropriate code provider and writes it to the /// desired location. /// </summary> public static CodeWriterOutput Write(CodeNamespace codeNamespace, Configuration configuration, CodeWriterOptions options, List<TextFile> textFiles, CodeDomProvider provider) { // Create a new instance of CodeWriter class with given options. CodeWriter writer = new CodeWriter(codeNamespace, configuration, options, textFiles, provider); // Execute the code writing procedure. writer.WriteCodeFiles(); // Crate an instance of CodeWriterOutput class with the code writer's output. CodeWriterOutput output = new CodeWriterOutput(writer.generatedCodeFileNames, writer.configurationFile); // Finally return the CodeWriterOutput. return output; }
// Filters the code writer options. private static CodeWriterOptions GetCodeWriterOptions(CodeGenerationOptions options) { CodeWriterOptions writerOptions = new CodeWriterOptions(); writerOptions.GenerateSeparateFiles = options.GenerateSeparateFiles; writerOptions.ConfigurationFile = options.ConfigurationFile; writerOptions.OutputLocation = options.OutputLocation; writerOptions.ProjectDirectory = options.ProjectDirectory; writerOptions.OutputFileName = options.OutputFileName; writerOptions.OverwriteExistingFiles = options.OverwriteExistingFiles; writerOptions.Language = options.Language; return writerOptions; }
// Filters the code writer options. private static CodeWriterOptions GetCodeWriterOptions(CodeGenerationOptions options) { CodeWriterOptions writerOptions = new CodeWriterOptions(); writerOptions.GenerateSeparateFiles = options.GenerateSeparateFiles; writerOptions.ConfigurationFile = options.ConfigurationFile; writerOptions.OutputLocation = options.OutputLocation; writerOptions.ProjectDirectory = options.ProjectDirectory; writerOptions.OutputFileName = options.OutputFileName; writerOptions.OverwriteExistingFiles = options.OverwriteExistingFiles; writerOptions.Language = options.Language; return(writerOptions); }
/// <summary> /// Generates the code using the appropriate code provider and writes it to the /// desired location. /// </summary> public static CodeWriterOutput Write(CodeNamespace codeNamespace, Configuration configuration, CodeWriterOptions options, List <TextFile> textFiles, CodeDomProvider provider) { // Create a new instance of CodeWriter class with given options. CodeWriter writer = new CodeWriter(codeNamespace, configuration, options, textFiles, provider); // Execute the code writing procedure. writer.WriteCodeFiles(); // Crate an instance of CodeWriterOutput class with the code writer's output. CodeWriterOutput output = new CodeWriterOutput(writer.generatedCodeFileNames, writer.configurationFile); // Finally return the CodeWriterOutput. return(output); }