@@ -176,6 +176,31 @@ internal void ValidateVersionField(FieldDef field, bool isKeyField)
176176 Strings . ExUnableToApplyVersionOnFieldXOfTypeY , field . Name , field . ValueType . GetShortName ( ) ) ) ;
177177 }
178178
179+ public void ValidateHierarchyEquality ( TypeDef @interface , HierarchyDef first , HierarchyDef second )
180+ {
181+ // TypeId mode must match
182+ if ( first . IncludeTypeId != second . IncludeTypeId )
183+ throw new DomainBuilderException ( string . Format (
184+ Strings . ExImplementorsOfXInterfaceBelongToHierarchiesOneOfWhichIncludesTypeIdButAnotherDoesntYZ ,
185+ @interface . Name , first . Root . Name , second . Root . Name ) ) ;
186+
187+ // Number of key fields must match
188+ if ( first . KeyFields . Count != second . KeyFields . Count )
189+ throw new DomainBuilderException ( string . Format (
190+ Strings . ExImplementorsOfXInterfaceBelongToHierarchiesWithDifferentKeyStructureYZ ,
191+ @interface . Name , first . Root . Name , second . Root . Name ) ) ;
192+
193+ // Type of each key field must match
194+ for ( int i = 0 ; i < first . KeyFields . Count ; i ++ ) {
195+ var masterField = first . Root . Fields [ first . KeyFields [ i ] . Name ] ;
196+ var candidateField = second . Root . Fields [ second . KeyFields [ i ] . Name ] ;
197+ if ( masterField . ValueType != candidateField . ValueType )
198+ throw new DomainBuilderException ( string . Format (
199+ Strings . ExImplementorsOfXInterfaceBelongToHierarchiesWithDifferentKeyStructureYZ ,
200+ @interface . Name , first . Root . Name , second . Root . Name ) ) ;
201+ }
202+ }
203+
179204 internal void ValidateType ( TypeDef typeDef , HierarchyDef hierarchyDef )
180205 {
181206 }
@@ -223,30 +248,5 @@ public Validator(IEnumerable<Type> validFieldTypes)
223248
224249 ValidFieldTypes = new HashSet < Type > ( validFieldTypes ) { typeof ( Key ) } ;
225250 }
226-
227- public void ValidateHierarchyEquality ( TypeDef @interface , HierarchyDef first , HierarchyDef second )
228- {
229- // TypeId mode must match
230- if ( first . IncludeTypeId != second . IncludeTypeId )
231- throw new DomainBuilderException ( string . Format (
232- Strings . ExImplementorsOfXInterfaceBelongToHierarchiesOneOfWhichIncludesTypeIdButAnotherDoesntYZ ,
233- @interface . Name , first . Root . Name , second . Root . Name ) ) ;
234-
235- // Number of key fields must match
236- if ( first . KeyFields . Count != second . KeyFields . Count )
237- throw new DomainBuilderException ( string . Format (
238- Strings . ExImplementorsOfXInterfaceBelongToHierarchiesWithDifferentKeyStructureYZ ,
239- @interface . Name , first . Root . Name , second . Root . Name ) ) ;
240-
241- // Type of each key field must match
242- for ( int i = 0 ; i < first . KeyFields . Count ; i ++ ) {
243- var masterField = first . Root . Fields [ first . KeyFields [ i ] . Name ] ;
244- var candidateField = second . Root . Fields [ second . KeyFields [ i ] . Name ] ;
245- if ( masterField . ValueType != candidateField . ValueType )
246- throw new DomainBuilderException ( string . Format (
247- Strings . ExImplementorsOfXInterfaceBelongToHierarchiesWithDifferentKeyStructureYZ ,
248- @interface . Name , first . Root . Name , second . Root . Name ) ) ;
249- }
250- }
251251 }
252252}
0 commit comments