コード例 #1
0
        public virtual int Compare(IUpdateEntry?x, IUpdateEntry?y)
        {
            if (ReferenceEquals(x, y))
            {
                return(0);
            }

            if (x is null)
            {
                return(-1);
            }

            if (y is null)
            {
                return(1);
            }

            var xValue = x.GetCurrentValue <TModel>(_property);
            var yValue = y.GetCurrentValue <TModel>(_property);

            return(xValue == null &&
                   yValue == null
                    ? 0
                    : xValue == null
                        ? -1
                        : yValue == null
                            ? 1
                            : _underlyingComparer.Compare(_converter(xValue), _converter(yValue)));
        }
コード例 #2
0
        public override int Compare(IUpdateEntry?x, IUpdateEntry?y)
        {
            if (ReferenceEquals(x, y))
            {
                return(0);
            }

            if (x is null)
            {
                return(-1);
            }

            if (y is null)
            {
                return(1);
            }

            var xValue = GetPropertyValue(x);
            var yValue = GetPropertyValue(y);

            return(xValue is Array xArray &&
                   yValue is Array yArray &&
                   xArray.Length != yArray.Length
                    ? xArray.Length - yArray.Length
                    : base.ComparePropertyValues(xValue, yValue));
        }
コード例 #3
0
        public virtual int Compare(IUpdateEntry?x, IUpdateEntry?y)
        {
            if (ReferenceEquals(x, y))
            {
                return(0);
            }

            if (x is null)
            {
                return(-1);
            }

            if (y is null)
            {
                return(1);
            }

            return(ComparePropertyValues(x.GetCurrentValue(_property), y.GetCurrentValue(_property)));
        }
コード例 #4
0
        /// <summary>
        ///     Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
        /// </summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>A negative number if 'x' is less than 'y'; a positive number if 'x' is greater than 'y'; zero otherwise.</returns>
        public int Compare(IUpdateEntry?x, IUpdateEntry?y)
        {
            if (ReferenceEquals(x, y))
            {
                return(0);
            }

            if (x is null)
            {
                return(-1);
            }

            if (y is null)
            {
                return(1);
            }

            return(_underlyingComparer.Compare(
                       x.GetCurrentValue <TProperty>(_property),
                       y.GetCurrentValue <TProperty>(_property)));
        }
コード例 #5
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public virtual int Compare(IUpdateEntry?x, IUpdateEntry?y)
        {
            if (ReferenceEquals(x, y))
            {
                return(0);
            }

            if (x is null)
            {
                return(-1);
            }

            if (y is null)
            {
                return(1);
            }

            return(_underlyingComparer.Compare(
                       _converter(x.GetCurrentValue <TModel>(_property)),
                       _converter(y.GetCurrentValue <TModel>(_property))));
        }
コード例 #6
0
        public int Compare(IUpdateEntry?x, IUpdateEntry?y)
        {
            if (ReferenceEquals(x, y))
            {
                return(0);
            }

            if (x == null)
            {
                return(-1);
            }

            if (y == null)
            {
                return(1);
            }

            return(!_table.GetRowInternalForeignKeys(x.EntityType).Any()
                ? -1
                : !_table.GetRowInternalForeignKeys(y.EntityType).Any()
                    ? 1
                    : StringComparer.Ordinal.Compare(x.EntityType.Name, y.EntityType.Name));
        }
コード例 #7
0
 /// <summary>
 ///     Determines whether the specified objects are equal.
 /// </summary>
 /// <param name="x">The first object to compare.</param>
 /// <param name="y">The second object to compare.</param>
 /// <returns><see langword="true" /> if the specified objects are equal; otherwise, <see langword="false" />.</returns>
 public bool Equals(IUpdateEntry?x, IUpdateEntry?y)
 => Compare(x, y) == 0;