Пример #1
0
        // Note: these methods should be equivalent to producing the proto representations and checking those for
        // equality, but that would be expensive.

        /// <summary>
        /// Compares this query with another for equality. Every aspect of the query must be equal,
        /// including the collection. A plain Query instance is not equal to a CollectionReference instance,
        /// even if they are logically similar: <c>collection.Offset(0).Equals(collection)</c> will return
        /// <c>false</c>, even though 0 is the default offset.
        /// </summary>
        /// <param name="other">The query to compare this one with</param>
        /// <returns><c>true</c> if this query is equal to <paramref name="other"/>; <c>false</c> otherwise.</returns>
        public bool Equals(Query other)
        {
            if (ReferenceEquals(other, this))
            {
                return(true);
            }
            if (ReferenceEquals(other, null))
            {
                return(false);
            }
            if (GetType() != other.GetType())
            {
                return(false);
            }
            return(Collection.Equals(other.Collection) &&
                   _offset == other._offset &&
                   _limit == other._limit &&
                   EqualityHelpers.ListsEqual(_orderings, other._orderings) &&
                   EqualityHelpers.ListsEqual(_filters, other._filters) &&
                   EqualityHelpers.ListsEqual(_projections, other._projections) &&
                   Equals(_startAt, other._startAt) &&
                   Equals(_endAt, other._endAt));
        }
Пример #2
0
 /// <summary>
 /// Compares this snapshot with another for equality. The documents and query are compared;
 /// the read time is not.
 /// </summary>
 /// <param name="other">The snapshot to compare this one with</param>
 /// <returns><c>true</c> if this snapshot is equal to <paramref name="other"/>; <c>false</c> otherwise.</returns>
 public bool Equals(QuerySnapshot other) =>
 other != null &&
 Query.Equals(other.Query) &&
 EqualityHelpers.ListsEqual(Documents, other.Documents);
Пример #3
0
 /// <summary>
 /// Compares this set-options with another for equality.
 /// </summary>
 /// <param name="other">The set options to compare this one with</param>
 /// <returns><c>true</c> if this value is equal to <paramref name="other"/>; <c>false</c> otherwise.</returns>
 public bool Equals(SetOptions other) =>
 other != null &&
 Merge == other.Merge &&
 EqualityHelpers.ListsEqual(FieldMask, other.FieldMask);