コード例 #1
0
        private DeduplicationResult GetResult(
            Dictionary <EntityIdentifier, MatchWeight> duplicates)
        {
            DeduplicationResult result;

            if (duplicates.Count == 0)
            {
                // no duplicates found => this is a new entity
                result = new DeduplicationResult(DeduplicationStatus.NewEntity);
            }
            else if (duplicates.Count(d => d.Value == MatchWeight.Inconsistent) >= 1)
            {
                // at least one duplicate inconsistent => refer for manual inspection
                result = new DeduplicationResult(
                    DeduplicationStatus.ManualInspectionRequired,
                    this.GetDuplicatesCollection(duplicates));
            }
            else if (duplicates.Count(d => d.Value == MatchWeight.Positive) == 1)
            {
                // a single positive duplicate found
                EntityIdentifier duplicateId =
                    duplicates.First(d => d.Value == MatchWeight.Positive).Key;
                result = new DeduplicationResult(
                    DeduplicationStatus.DuplicateFound, duplicateId);
            }
            else
            {
                // a number of candidate duplicates (or multiple positives) found
                // => refer for manual inspection
                result = new DeduplicationResult(
                    DeduplicationStatus.ManualInspectionRequired,
                    this.GetDuplicatesCollection(duplicates));
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Deduplicates the specified source system entity.
        /// </summary>
        /// <param name="entity">The entity to deduplicate.</param>
        /// <returns>The result of the deduplication process.</returns>
        public DeduplicationResult Deduplicate(TEntity entity)
        {
            Dictionary <EntityIdentifier, MatchWeight>
            duplicates = this.ApplyRules(entity);
            DeduplicationResult result = this.GetResult(duplicates);

            return(result);
        }