@@ -79,7 +79,7 @@ namespace HarmonyCoreExtensions
7979 foreach customRelation in customRelationSpecs
8080 begin
8181 data relationLookup = string.Format("{0}-{1}-{2}-{3}", customRelation.FromStructure, customRelation.ToStructure, customRelation.FromKey, customRelation.ToKey)
82- data madeRelation = MakeRelation(customRelation.FromStructure, customRelation.ToStructure, customRelation.FromKey, customRelation.ToKey, customRelation.RequiresMatch)
82+ data madeRelation = MakeRelation(customRelation.FromStructure, customRelation.ToStructure, customRelation.FromKey, customRelation.ToKey, customRelation.RequiresMatch, customRelation.ValidationMode )
8383
8484 if(!string.IsNullOrWhitespace(customRelation.BackRelation))
8585 madeRelation.BackRelation = customRelation.BackRelation
@@ -149,7 +149,7 @@ namespace HarmonyCoreExtensions
149149 required in fromKey, @string
150150 required in toKey, @string
151151 proc
152- mreturn MakeRelation(fromStructure,toStructure,fromKey,toKey,true )
152+ mreturn MakeRelation(fromStructure,toStructure,fromKey,toKey,false,RelationValidationMode.None )
153153 endmethod
154154
155155 ;;; <summary>
@@ -167,6 +167,7 @@ namespace HarmonyCoreExtensions
167167 required in fromKey, @string
168168 required in toKey, @string
169169 required in aRequiresMatch, boolean
170+ required in aValidationMode, RelationValidationMode
170171 proc
171172 data fromRealStructure = Context.Structures.FirstOrDefault(lambda(str) { str.Name == fromStructure })
172173 if (fromRealStructure == ^null)
@@ -198,6 +199,7 @@ namespace HarmonyCoreExtensions
198199 madeRelation.FromStructure = fromStructure
199200 madeRelation.ToStructure = toStructure
200201 madeRelation.RequiresMatch = aRequiresMatch
202+ madeRelation.ValidationMode = aValidationMode
201203 SynthesizeRelationInfo(fromRealStructure, toRealStructure, realFromKey, realToKey, madeRelation)
202204 mreturn madeRelation
203205 endmethod
@@ -407,6 +409,29 @@ namespace HarmonyCoreExtensions
407409 mreturn targetRelation.RequiresMatch
408410 endmethod
409411
412+ ;;; <summary>
413+ ;;; What is the ValidationMode of the relation?
414+ ;;; </summary>
415+ ;;; <param name="context"></param>
416+ ;;; <param name="fromStructure"></param>
417+ ;;; <param name="fromkey"></param>
418+ ;;; <param name="tostr"></param>
419+ ;;; <param name="tokey"></param>
420+ ;;; <returns>True if matching data is required</returns>
421+ public static method ValidationMode, RelationValidationMode
422+ required in context, @CodeGenContext
423+ required in fromStructure, @RpsStructure
424+ required in fromkey, @RpsKey
425+ required in tostr, @RpsStructure
426+ required in tokey, @RpsKey
427+ proc
428+ data targetRelation = GetRelationSpec(context, fromStructure, toStr, fromkey, tokey, false)
429+ ;;Figure out a default based on the value of the DEPRECATED property RequiresMatch
430+ data notPresentDefault, RelationValidationMode, targetRelation.RequiresMatch ? RelationValidationMode.Always : RelationValidationMode.None
431+ ;;Return the value. If not specified, use the default based on RequiresMatch.
432+ mreturn targetRelation.ValidationMode != RelationValidationMode.Unspecified ? targetRelation.ValidationMode : notPresentDefault
433+ endmethod
434+
410435 endclass
411436
412437endnamespace
0 commit comments