Skip to content

Commit

Permalink
Generate XmlArrayAttribute only if outer element has MaxOccurs="1" an…
Browse files Browse the repository at this point in the history
…d inner has MaxOccurs > 1

Closes #9
  • Loading branch information
Michael Ganss committed Aug 13, 2015
1 parent c2d01db commit 033292e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion XmlSchemaClassGenerator/TypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,9 @@ public void AddMembersTo(CodeTypeDeclaration typeDeclaration, bool withDataBindi
CodeTypeMember member;

var typeClassModel = Type as ClassModel;
var isArray = !IsAttribute && typeClassModel != null && typeClassModel.TotalProperties == 1
var isArray = !IsCollection && !IsAttribute && typeClassModel != null && typeClassModel.TotalProperties == 1
&& !typeClassModel.Properties[0].IsAttribute && !typeClassModel.Properties[0].IsAny
&& typeClassModel.Properties[0].IsCollection
&& typeClassModel.BaseClass == null;
var propertyType = !isArray ? Type : typeClassModel.Properties[0].Type;
var isNullableValueType = DefaultValue == null
Expand Down
2 changes: 1 addition & 1 deletion XmlSchemaClassGenerator/XmlSchemaClassGenerator.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<projectUrl>https://github.com/mganss/XmlSchemaClassGenerator</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>Add basic EF Code First support.</releaseNotes>
<releaseNotes>Bugfix release.</releaseNotes>
<copyright>Copyright 2013-2015 Michael Ganss</copyright>
<tags>xsd</tags>
</metadata>
Expand Down

0 comments on commit 033292e

Please sign in to comment.