public void AddOrMerge(MultiReadResult <TKey, TEntry> result) { foreach (var item in result) { AddOrMerge(item); } }
public MultiReadResult <TKey, TEntry> MergeInto(MultiReadResult <TKey, TEntry> other) { foreach (var otherResult in other) { var thisResult = FindResult(otherResult.Key); otherResult.MergeWith(thisResult); } return(this); }
public MultiReadResult <TKey, TEntry> MergeWith(MultiReadResult <TKey, TEntry> other) { foreach (var thisResult in this) { var otherResult = other.FindResult(thisResult.Key); thisResult.MergeWith(otherResult); } return(this); }
public static MultiReadResult <TKey, TEntry> Combine <TKey, TEntry>(this IEnumerable <MultiReadResult <TKey, TEntry> > that) where TEntry : IEntry { var result = new MultiReadResult <TKey, TEntry>(); foreach (var item in that) { result.AddOrMerge(item); } return(result); }
public static MultiReadResult <TKey, TEntry> Combine <TKey, TEntry>(this IEnumerable <MultiReadResult <TKey, TEntry> > that, int count) where TEntry : IEntry { if (count == 1) { return(that.First()); } var dictionary = CreateDictionary(that.SelectMany(x => x)); var result = new MultiReadResult <TKey, TEntry>(); foreach (var kvp in dictionary) { var key = kvp.Key; var values = kvp.Value; var sort = values[0].Sort; var readResult = new ReadResult <TKey, TEntry>(key, sort, values); result.AddResult(readResult); } return(result); }