Skip to content

Commit

Permalink
Do not generate duplicate properties with same name and type (fixes #401
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Michael Ganss committed Jul 24, 2023
1 parent 595f179 commit 7e5b04a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,15 @@ private PropertyModel PropertyFromElement(TypeModel owningTypeModel, XmlSchemaEl
{
PropertyModel property;
XmlSchemaElementEx effectiveElement = substitute?.Element ?? element;

property = properties.FirstOrDefault(p => element.QualifiedName == p.XmlSchemaName && p.Type.XmlSchemaType == element.ElementSchemaType);

if (property != null)
{
property.IsCollection = true;
return property;
}

var name = _configuration.NamingProvider.ElementNameFromQualifiedName(effectiveElement.QualifiedName, effectiveElement);
var originalName = name;
if (name == owningTypeModel.Name)
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.0.{build}
version: 2.0.{build}-beta
skip_tags: true
image: Visual Studio 2022
environment:
Expand Down

0 comments on commit 7e5b04a

Please sign in to comment.