internal TRules GetMergerRulesForWithDefault <TRules>(Type type, IAlgorithmRules ignore) where TRules : class, IAlgorithmRules { TRules ret = this.GetMergerRulesFor <TRules>(type, ignore); if (ret != null) { return(ret); } if (this.aRulesNotFoundFallback != null) { ret = RulesNotFoundFallbackMembers.RulesNotFoundFallback(typeof(TRules), type) .Invoke(this.aRulesNotFoundFallback, new object[] { new MergerRulesLocator(this) }) as TRules; } if (ret == null) { ret = this.GuessRules <TRules>(type); } ret?.Initialize(this); return(ret); }
internal TRules GetMergerRulesFor <TRules>(Type type, IAlgorithmRules ignore) where TRules : class, IAlgorithmRules { foreach (IClassMergerDefinition definition in this.GetDefinitionFor(type)) { TRules rules = definition.GetRules <TRules>(ignore); if (rules != null) { return(rules); } } for (Type tmp = type.BaseType; tmp != null; tmp = tmp.BaseType) { foreach (IClassMergerDefinition definition in this.GetDefinitionFor(tmp)) { foreach (TRules rules in definition.GetAllRules <TRules>()) { if (rules is IInheritableAlgorithmRules inheritable) { if (inheritable.IsInheritable) { return(rules); } } } } } return(null); }
private IAlgorithmRules GetAncestor <TRules>(Type type) where TRules : class, IAlgorithmRules <TClass> { Type tmp = type; while (tmp.BaseType != null) { tmp = tmp.BaseType; foreach (IClassMergerDefinition def in this.aDefinitions) { if (def.DefinedFor == tmp) { IAlgorithmRules rules = def.GetRules(typeof(TRules)); if (rules is IInheritableAlgorithmRules inheritable) { if (inheritable.IsInheritable) { return(rules); } } } } } return(null); }
public ApplyValuePatch(MergerImplementation mergerImplementation, IAlgorithmRules rules) { this.aMergerImplementation = mergerImplementation; this.aRules = rules; this.aTypes = new Dictionary <Type, IApplyPatchAlgorithm>(); }
TRules IClassMergerDefinition.GetRules <TRules>(IAlgorithmRules ignore) { return(this.aRules.OfType <TRules>().FirstOrDefault(x => x != ignore)); }
public MergeValueDiffs(MergerImplementation mergerImplementation, IAlgorithmRules rules) { this.aMergerImplementation = mergerImplementation; this.aRules = rules; }