From 8094415864a070eeb097d402ea0fa2fe60621bf0 Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Fri, 24 Apr 2020 12:27:19 +0200 Subject: [PATCH] Add more MemberVisitor calls (see #184) --- XmlSchemaClassGenerator/TypeModel.cs | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/XmlSchemaClassGenerator/TypeModel.cs b/XmlSchemaClassGenerator/TypeModel.cs index 3d083cc4..d66a8470 100644 --- a/XmlSchemaClassGenerator/TypeModel.cs +++ b/XmlSchemaClassGenerator/TypeModel.cs @@ -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", @@ -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); } } @@ -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) @@ -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)