public MutatorsTreeBase <TSource> GetValidationsTree(MutatorsContext context, int priority) { var slot = GetOrCreateHashtableSlot(context); var result = (MutatorsTreeBase <TSource>)slot.ValidationMutatorsTrees[priority]; if (result == null) { lock (lockObject) { result = (MutatorsTreeBase <TSource>)slot.ValidationMutatorsTrees[priority]; if (result == null) { slot.ValidationMutatorsTrees[priority] = result = new MutatorsTree <TSource>(slot.ValidationsTree, pathFormatterCollection.GetPathFormatter <TSource>(), pathFormatterCollection, priority); } } } return(result); }
public MutatorsTreeBase <TData> GetMutatorsTree(MutatorsContext context, int validationsPriority = 0) { if (context == null) { throw new ArgumentNullException("context"); } var slot = GetOrCreateHashtableSlot(context); var result = (MutatorsTreeBase <TData>)slot.MutatorsTrees[validationsPriority]; if (result == null) { lock (lockObject) { result = (MutatorsTreeBase <TData>)slot.MutatorsTrees[validationsPriority]; if (result == null) { slot.MutatorsTrees[validationsPriority] = result = new MutatorsTree <TData>(slot.Tree, pathFormatterCollection.GetPathFormatter <TData>(), pathFormatterCollection, validationsPriority); } } } return(result); }