/// <summary> /// This is used implicitly by -[LiveQuery update] to decide whether the query result has changed /// enough to notify the client. /// </summary> /// <remarks> /// This is used implicitly by -[LiveQuery update] to decide whether the query result has changed /// enough to notify the client. So it's important that it not give false positives, else the app /// won't get notified of changes. /// </remarks> public override bool Equals(object obj) { if (obj == this) { return(true); } if (!(obj is QueryRow)) { return(false); } var other = (QueryRow)obj; var documentPropertiesEqual = Misc.IsEqual(DocumentProperties, other.DocumentProperties); if (Database == other.Database && Misc.IsEqual(Key, other.Key) && Misc.IsEqual(SourceDocumentId, other.SourceDocumentId) && documentPropertiesEqual) { // If values were emitted, compare them. Otherwise we have nothing to go on so check // if _anything_ about the doc has changed (i.e. the sequences are different.) if (Value != null || other.Value != null) { return(Value.Equals(other.Value)); } else { return(SequenceNumber == other.SequenceNumber); } } return(false); }