@@ -69,6 +69,7 @@ public ModelBuilder(GeneratorConfiguration configuration, XmlSchemaSet set)
6969
7070 if ( configuration . GenerateInterfaces )
7171 {
72+ PromoteInterfacePropertiesToCollection ( ) ;
7273 RenameInterfacePropertiesIfRenamedInDerivedClasses ( ) ;
7374 RemoveDuplicateInterfaceProperties ( ) ;
7475 }
@@ -184,7 +185,8 @@ private void RenameInterfacePropertiesIfRenamedInDerivedClasses()
184185 {
185186 if ( implementationClassProperty . Name != implementationClassProperty . OriginalPropertyName
186187 && implementationClassProperty . OriginalPropertyName == interfaceProperty . Name
187- && implementationClassProperty . XmlSchemaName == interfaceProperty . XmlSchemaName )
188+ && implementationClassProperty . XmlSchemaName == interfaceProperty . XmlSchemaName
189+ && implementationClassProperty . IsAttribute == interfaceProperty . IsAttribute )
188190 {
189191 RenameInterfacePropertyInBaseClasses ( interfaceModel , implementationClass , interfaceProperty , implementationClassProperty . Name ) ;
190192 interfaceProperty . Name = implementationClassProperty . Name ;
@@ -195,6 +197,28 @@ private void RenameInterfacePropertiesIfRenamedInDerivedClasses()
195197 }
196198 }
197199
200+ private void PromoteInterfacePropertiesToCollection ( )
201+ {
202+ foreach ( var interfaceModel in Types . Values . OfType < InterfaceModel > ( ) )
203+ {
204+ foreach ( var interfaceProperty in interfaceModel . Properties )
205+ {
206+ var derivedProperties = interfaceModel . AllDerivedReferenceTypes ( ) . SelectMany ( t => t . Properties )
207+ . Where ( p => p . Name == interfaceProperty . Name || p . OriginalPropertyName == interfaceProperty . Name ) . ToList ( ) ;
208+
209+ if ( derivedProperties . Any ( p => p . IsCollection ) )
210+ {
211+ foreach ( var derivedProperty in derivedProperties . Where ( p => ! p . IsCollection ) )
212+ {
213+ derivedProperty . IsCollection = true ;
214+ }
215+
216+ interfaceProperty . IsCollection = true ;
217+ }
218+ }
219+ }
220+ }
221+
198222 private static void RenameInterfacePropertyInBaseClasses ( InterfaceModel interfaceModel , ReferenceTypeModel implementationClass ,
199223 PropertyModel interfaceProperty , string newName )
200224 {
@@ -752,6 +776,7 @@ private IEnumerable<PropertyModel> CreatePropertiesForAttributes(Uri source, Typ
752776 {
753777 var attributeQualifiedName = attribute . AttributeSchemaType . QualifiedName ;
754778 var attributeName = _configuration . NamingProvider . AttributeNameFromQualifiedName ( attribute . QualifiedName , attribute ) ;
779+ var originalAttributeName = attributeName ;
755780
756781 if ( attribute . Parent is XmlSchemaAttributeGroup attributeGroup
757782 && attributeGroup . QualifiedName != typeModel . XmlSchemaName
@@ -795,6 +820,7 @@ private IEnumerable<PropertyModel> CreatePropertiesForAttributes(Uri source, Typ
795820 {
796821 OwningType = typeModel ,
797822 Name = attributeName ,
823+ OriginalPropertyName = originalAttributeName ,
798824 XmlSchemaName = attribute . QualifiedName ,
799825 Type = CreateTypeModel ( attribute . AttributeSchemaType , attributeQualifiedName ) ,
800826 IsAttribute = true ,
0 commit comments