Skip to content

Commit

Permalink
Correct order propery to correctly increment on recusion
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeSchimo committed Oct 19, 2020
1 parent 561d75c commit 1345d0b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions XmlSchemaClassGenerator/ModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -665,10 +665,9 @@ private IEnumerable<PropertyModel> CreatePropertiesForAttributes(Uri source, Typ
return properties;
}

private IEnumerable<PropertyModel> CreatePropertiesForElements(Uri source, TypeModel typeModel, XmlSchemaParticle particle, IEnumerable<Particle> items)
private IEnumerable<PropertyModel> CreatePropertiesForElements(Uri source, TypeModel typeModel, XmlSchemaParticle particle, IEnumerable<Particle> items, int order = 0)
{
var properties = new List<PropertyModel>();
var order = 0;

foreach (var item in items)
{
Expand Down Expand Up @@ -755,7 +754,11 @@ private IEnumerable<PropertyModel> CreatePropertiesForElements(Uri source, TypeM
}

var groupItems = GetElements(groupRef.Particle);
var groupProperties = CreatePropertiesForElements(source, typeModel, item.XmlParticle, groupItems);
var groupProperties = CreatePropertiesForElements(source, typeModel, item.XmlParticle, groupItems, order).ToList();
if (_configuration.EmitOrder)
{
order += groupProperties.Count;
}
properties.AddRange(groupProperties);
}
}
Expand Down

0 comments on commit 1345d0b

Please sign in to comment.