Skip to content

Commit d76ad43

Browse files
author
Michael Ganss
committed
Merge branch 'master' of github.com:mganss/XmlSchemaClassGenerator
2 parents 790a656 + 446e601 commit d76ad43

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

XmlSchemaClassGenerator.Console/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static void Main(string[] args)
3434
var codeTypeReferenceOptions = default(CodeTypeReferenceOptions);
3535
string textValuePropertyName = "Value";
3636
var generateDebuggerStepThroughAttribute = true;
37+
var disableComments = false;
3738

3839
var options = new OptionSet {
3940
{ "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
7475
{ "cit|collectionImplementationType=", "the default collection type implementation to use (default is null)", v => collectionImplementationType = v == null ? null : Type.GetType(v, true) },
7576
{ "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) },
7677
{ "tvpn|textValuePropertyName=", "the name of the property that holds the text value of an element (default is Value)", v => textValuePropertyName = v },
77-
{ "dst|debuggerStepThrough", "generate DebuggerStepThroughAttribute (default is enabled)", v => generateDebuggerStepThroughAttribute = v != null }
78+
{ "dst|debuggerStepThrough", "generate DebuggerStepThroughAttribute (default is enabled)", v => generateDebuggerStepThroughAttribute = v != null },
79+
{ "dc|disableComments", "do not include comments from xsd", v => disableComments = v != null },
7880
};
7981

8082
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
116118
CollectionImplementationType = collectionImplementationType,
117119
CodeTypeReferenceOptions = codeTypeReferenceOptions,
118120
TextValuePropertyName = textValuePropertyName,
119-
GenerateDebuggerStepThroughAttribute = generateDebuggerStepThroughAttribute
121+
GenerateDebuggerStepThroughAttribute = generateDebuggerStepThroughAttribute,
122+
DisableComments = disableComments
120123
};
121124

122125
if (pclCompatible)
@@ -129,7 +132,7 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l
129132
}
130133

131134
if (verbose) { generator.Log = s => System.Console.Out.WriteLine(s); }
132-
135+
133136
generator.Generate(files);
134137
}
135138

XmlSchemaClassGenerator/Generator.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ public Action<CodeTypeMember, PropertyModel> MemberVisitor
167167
set { _configuration.MemberVisitor = value;}
168168
}
169169

170+
public bool DisableComments
171+
{
172+
get { return _configuration.DisableComments; }
173+
set { _configuration.DisableComments = value; }
174+
}
175+
170176
private readonly XmlSchemaSet Set = new XmlSchemaSet();
171177
private Dictionary<XmlQualifiedName, XmlSchemaAttributeGroup> AttributeGroups;
172178
private Dictionary<XmlQualifiedName, XmlSchemaGroup> Groups;
@@ -242,6 +248,7 @@ private string ToTitleCase(string s)
242248

243249
private void BuildModel()
244250
{
251+
DocumentationModel.DisableComments = _configuration.DisableComments;
245252
var objectModel = new SimpleModel(_configuration)
246253
{
247254
Name = "AnyType",

XmlSchemaClassGenerator/GeneratorConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,7 @@ public void WriteLog(string message)
154154
/// Provides options to customize Elementnamens with own logik
155155
/// </summary>
156156
public NamingProvider NamingProvider { get; set; }
157+
158+
public bool DisableComments { get; set; }
157159
}
158160
}

XmlSchemaClassGenerator/TypeModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ public class DocumentationModel
6868
{
6969
public string Language { get; set; }
7070
public string Text { get; set; }
71+
public static bool DisableComments { get; set; }
7172

7273
public static IEnumerable<CodeCommentStatement> GetComments(IEnumerable<DocumentationModel> docs)
7374
{
75+
if (DisableComments)
76+
yield break;
77+
7478
yield return new CodeCommentStatement("<summary>", true);
7579

7680
foreach (var doc in docs.OrderBy(d => d.Language))

0 commit comments

Comments
 (0)