Example #1
0
        public ReconciliationStatus ReconcileRecords(Record left, Record right, IRecordKeyComparer recordKeyComparer)
        {
            var fieldComparisonResult = recordKeyComparer.Compare(left, right);
            if (fieldComparisonResult == 0)
            {
                return DictionaryAllEntriesMatch(left, right) ? ReconciliationStatus.Same : ReconciliationStatus.Updated;
            }

            return fieldComparisonResult < 0 ? ReconciliationStatus.Deleted : ReconciliationStatus.Added;
        }
        public IEnumerable<ReconciliationResult<Record>> Reconcile(IEnumerable<Record> left, IEnumerable<Record> right, IRecordReconciler recordReconciler, IRecordKeyComparer recordKeyComparer)
        {
            if (left == null)
            {
                throw new ArgumentNullException("left");
            }
            if (right == null)
            {
                throw new ArgumentNullException("right");
            }
            if (recordKeyComparer == null)
            {
                throw new ArgumentNullException("recordKeyComparer");
            }

            var comparer = new OrderedReconciler<Record>();
            return comparer
                .Reconcile(left, right, (o, n) => recordReconciler.ReconcileRecords(o, n, recordKeyComparer))
                .Where(result => result.Status != ReconciliationStatus.Same);
        }
Example #3
0
 public static IEnumerable<Record> Sort(this IEnumerable<Record> input, IRecordKeyComparer comparer)
 {
     return input.OrderBy(x => x, comparer);
 }