Example #1
0
        /// <summary>
        ///     Gets the rows that have differences in the given fields.
        /// </summary>
        /// <param name="fieldName">Name of the field.</param>
        /// <returns>
        ///     Returns a <see cref="IEnumerable{T}" /> representing the rows that have differences.
        /// </returns>
        /// <exception cref="System.ArgumentOutOfRangeException">
        ///     sourceFieldName
        ///     or
        ///     targetFieldName
        /// </exception>
        public IEnumerable <IRow> GetRows(string fieldName)
        {
            var equailityComparer = new FieldsEqualityComparer();

            foreach (var source in this.GetRows(DeltaRowChangeVersion.SourceVersion))
            {
                var s = source.Fields.FindField(fieldName);
                if (s == -1)
                {
                    throw new ArgumentOutOfRangeException("fieldName");
                }

                foreach (var target in this.GetRows(DeltaRowChangeVersion.SourceVersion))
                {
                    var t = target.Fields.FindField(fieldName);
                    if (t == -1)
                    {
                        throw new ArgumentOutOfRangeException("fieldName");
                    }

                    if (!equailityComparer.Equals(source, target, s))
                    {
                        yield return(source);
                    }
                }
            }
        }