示例#1
0
        public override bool Equals(object @object)
        {
            if (@object == this)
            {
                return(true);
            }
            if (!(@object is Couchbase.Lite.QueryRow))
            {
                return(false);
            }
            Couchbase.Lite.QueryRow other   = (Couchbase.Lite.QueryRow)@object;
            bool documentPropertiesBothNull = (documentProperties == null && other.GetDocumentProperties
                                                   () == null);
            bool documentPropertiesEqual = documentPropertiesBothNull || documentProperties.Equals
                                               (other.GetDocumentProperties());

            if (database == other.database && key.Equals(other.GetKey()) && sourceDocumentId.
                Equals(other.GetSourceDocumentId()) && 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.GetValue() != null)
                {
                    return(value.Equals(other.GetValue()));
                }
                else
                {
                    return(sequence == other.sequence);
                }
            }
            return(false);
        }
示例#2
0
        internal void LoadCurrentRevisionFrom(QueryRow row)
        {
            if (row.GetDocumentRevisionId() == null)
            {
                return;
            }
            string revId = row.GetDocumentRevisionId();

            if (currentRevision == null || RevIdGreaterThanCurrent(revId))
            {
                IDictionary <string, object> properties = row.GetDocumentProperties();
                if (properties != null)
                {
                    RevisionInternal rev = new RevisionInternal(properties, row.GetDatabase());
                    currentRevision = new SavedRevision(this, rev);
                }
            }
        }
示例#3
0
		internal void LoadCurrentRevisionFrom(QueryRow row)
		{
			if (row.GetDocumentRevisionId() == null)
			{
				return;
			}
			string revId = row.GetDocumentRevisionId();
			if (currentRevision == null || RevIdGreaterThanCurrent(revId))
			{
				IDictionary<string, object> properties = row.GetDocumentProperties();
				if (properties != null)
				{
					RevisionInternal rev = new RevisionInternal(properties, row.GetDatabase());
					currentRevision = new SavedRevision(this, rev);
				}
			}
		}