diff --git a/XmlSchemaClassGenerator.Console/Program.cs b/XmlSchemaClassGenerator.Console/Program.cs index 85789e0b..61d4d233 100644 --- a/XmlSchemaClassGenerator.Console/Program.cs +++ b/XmlSchemaClassGenerator.Console/Program.cs @@ -34,6 +34,7 @@ static void Main(string[] args) var codeTypeReferenceOptions = default(CodeTypeReferenceOptions); string textValuePropertyName = "Value"; var generateDebuggerStepThroughAttribute = true; + var disableComments = false; var options = new OptionSet { { "h|help", "show this message and exit", v => showHelp = v != null }, @@ -74,7 +75,8 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l { "cit|collectionImplementationType=", "the default collection type implementation to use (default is null)", v => collectionImplementationType = v == null ? null : Type.GetType(v, true) }, { "ctro|codeTypeReferenceOptions=", "the default CodeTypeReferenceOptions Flags to use (default is unset; can be: {GlobalReference, GenericTypeParameter})", v => codeTypeReferenceOptions = v == null ? default(CodeTypeReferenceOptions) : (CodeTypeReferenceOptions)Enum.Parse(typeof(CodeTypeReferenceOptions), v, false) }, { "tvpn|textValuePropertyName=", "the name of the property that holds the text value of an element (default is Value)", v => textValuePropertyName = v }, - { "dst|debuggerStepThrough", "generate DebuggerStepThroughAttribute (default is enabled)", v => generateDebuggerStepThroughAttribute = v != null } + { "dst|debuggerStepThrough", "generate DebuggerStepThroughAttribute (default is enabled)", v => generateDebuggerStepThroughAttribute = v != null }, + { "dc|disableComments", "do not include comments from xsd", v => disableComments = v != null }, }; var files = options.Parse(args); @@ -116,7 +118,8 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l CollectionImplementationType = collectionImplementationType, CodeTypeReferenceOptions = codeTypeReferenceOptions, TextValuePropertyName = textValuePropertyName, - GenerateDebuggerStepThroughAttribute = generateDebuggerStepThroughAttribute + GenerateDebuggerStepThroughAttribute = generateDebuggerStepThroughAttribute, + DisableComments = disableComments }; if (pclCompatible) @@ -129,7 +132,7 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l } if (verbose) { generator.Log = s => System.Console.Out.WriteLine(s); } - + generator.Generate(files); } diff --git a/XmlSchemaClassGenerator/Generator.cs b/XmlSchemaClassGenerator/Generator.cs index eadb4b53..b6e071eb 100644 --- a/XmlSchemaClassGenerator/Generator.cs +++ b/XmlSchemaClassGenerator/Generator.cs @@ -167,6 +167,12 @@ public Action MemberVisitor set { _configuration.MemberVisitor = value;} } + public bool DisableComments + { + get { return _configuration.DisableComments; } + set { _configuration.DisableComments = value; } + } + private readonly XmlSchemaSet Set = new XmlSchemaSet(); private Dictionary AttributeGroups; private Dictionary Groups; @@ -242,6 +248,7 @@ private string ToTitleCase(string s) private void BuildModel() { + DocumentationModel.DisableComments = _configuration.DisableComments; var objectModel = new SimpleModel(_configuration) { Name = "AnyType", diff --git a/XmlSchemaClassGenerator/GeneratorConfiguration.cs b/XmlSchemaClassGenerator/GeneratorConfiguration.cs index 46bd5412..4c654c27 100644 --- a/XmlSchemaClassGenerator/GeneratorConfiguration.cs +++ b/XmlSchemaClassGenerator/GeneratorConfiguration.cs @@ -154,5 +154,7 @@ public void WriteLog(string message) /// Provides options to customize Elementnamens with own logik /// public NamingProvider NamingProvider { get; set; } + + public bool DisableComments { get; set; } } } diff --git a/XmlSchemaClassGenerator/TypeModel.cs b/XmlSchemaClassGenerator/TypeModel.cs index 310aedd5..d3121912 100644 --- a/XmlSchemaClassGenerator/TypeModel.cs +++ b/XmlSchemaClassGenerator/TypeModel.cs @@ -68,9 +68,13 @@ public class DocumentationModel { public string Language { get; set; } public string Text { get; set; } + public static bool DisableComments { get; set; } public static IEnumerable GetComments(IEnumerable docs) { + if (DisableComments) + yield break; + yield return new CodeCommentStatement("", true); foreach (var doc in docs.OrderBy(d => d.Language))