Skip to content

Commit

Permalink
Merge pull request #227 from JoeSchimo/master
Browse files Browse the repository at this point in the history
Correct order propery to correctly increment on recusion
  • Loading branch information
mganss authored Oct 20, 2020
2 parents 561d75c + 1345d0b commit d40150d
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 d40150d

Please sign in to comment.