Skip to content

Commit

Permalink
Add more MemberVisitor calls (see #184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ganss committed Apr 24, 2020
1 parent 54379ab commit 8094415
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions XmlSchemaClassGenerator/TypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ public override CodeTypeDeclaration Generate()
};
classDeclaration.Members.Add(propertyChangedEvent);

var propertyChangedModel = new PropertyModel(Configuration)
{
Name = propertyChangedEvent.Name,
OwningType = this,
Type = new SimpleModel(Configuration) { ValueType = typeof(PropertyChangedEventHandler) }
};

Configuration.MemberVisitor(propertyChangedEvent, propertyChangedModel);

var onPropChangedMethod = new CodeMemberMethod
{
Name = "OnPropertyChanged",
Expand Down Expand Up @@ -355,6 +364,15 @@ public override CodeTypeDeclaration Generate()

member.CustomAttributes.Add(attribute);
classDeclaration.Members.Add(member);

var valuePropertyModel = new PropertyModel(Configuration)
{
Name = Configuration.TextValuePropertyName,
OwningType = this,
Type = BaseClass
};

Configuration.MemberVisitor(member, valuePropertyModel);
}
}

Expand Down Expand Up @@ -415,6 +433,15 @@ public override CodeTypeDeclaration Generate()
var xmlTextAttribute = new CodeAttributeDeclaration(new CodeTypeReference(typeof(XmlTextAttribute), Configuration.CodeTypeReferenceOptions));
text.CustomAttributes.Add(xmlTextAttribute);
classDeclaration.Members.Add(text);

var textPropertyModel = new PropertyModel(Configuration)
{
Name = propName,
OwningType = this,
Type = new SimpleModel(Configuration) { ValueType = typeof(string) }
};

Configuration.MemberVisitor(text, textPropertyModel);
}

if (Configuration.GenerateDebuggerStepThroughAttribute)
Expand Down Expand Up @@ -948,6 +975,8 @@ public void AddMembersTo(CodeTypeDeclaration typeDeclaration, bool withDataBindi
specifiedMember?.CustomAttributes.Add(editorBrowsableAttribute);
member.CustomAttributes.Add(editorBrowsableAttribute);
if (Configuration.EntityFramework) { member.CustomAttributes.Add(notMappedAttribute); }

Configuration.MemberVisitor(nullableMember, this);
}
}
else if ((IsCollection || isArray || (IsList && IsAttribute)) && IsNullable)
Expand Down

0 comments on commit 8094415

Please sign in to comment.