From 033292e57dad793a4fe5e48cf7308512de5ff0a1 Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Thu, 13 Aug 2015 16:46:45 +0200 Subject: [PATCH] Generate XmlArrayAttribute only if outer element has MaxOccurs="1" and inner has MaxOccurs > 1 Closes #9 --- XmlSchemaClassGenerator/TypeModel.cs | 3 ++- XmlSchemaClassGenerator/XmlSchemaClassGenerator.nuspec | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/XmlSchemaClassGenerator/TypeModel.cs b/XmlSchemaClassGenerator/TypeModel.cs index 77b6a1ee..7571aa52 100644 --- a/XmlSchemaClassGenerator/TypeModel.cs +++ b/XmlSchemaClassGenerator/TypeModel.cs @@ -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 diff --git a/XmlSchemaClassGenerator/XmlSchemaClassGenerator.nuspec b/XmlSchemaClassGenerator/XmlSchemaClassGenerator.nuspec index 3d289e1e..36c6717e 100644 --- a/XmlSchemaClassGenerator/XmlSchemaClassGenerator.nuspec +++ b/XmlSchemaClassGenerator/XmlSchemaClassGenerator.nuspec @@ -10,7 +10,7 @@ https://github.com/mganss/XmlSchemaClassGenerator false $description$ - Add basic EF Code First support. + Bugfix release. Copyright 2013-2015 Michael Ganss xsd