Beispiel #1
0
        /// <summary>
        /// This is a bulk key request, not to be confused with requests using complex keys, see Key().
        /// </summary>
        /// <param name="keys">The keys.</param>
        /// <returns>CouchQuery.</returns>
        public BigDQuery Keys(object[] keys)
        {
            var bulk = new BigDBulkKeys(keys);
            var json = BigDDocument.WriteJson(bulk);

            Data(json);
            return(this);
        }
Beispiel #2
0
        /// <summary>
        /// This is a bulk key request, not to be confused with requests using complex keys, see Key().
        /// </summary>
        /// <param name="keys">The keys.</param>
        /// <returns>CouchQuery.</returns>
        public BigDQuery Keys(IList <object> keys)
        {
            var bulk = new BigDBulkKeys(keys.ToArray());
            var json = BigDDocument.WriteJson(bulk);

            Data(json);
            return(this);
        }
Beispiel #3
0
        /// <summary>
        /// Saves the commited.
        /// </summary>
        public void SaveCommited()
        {
            switch (ReconcileBy)
            {
            case ReconcileStrategy.AutoMergeFields:
                _sourceData = AutoClone();
                break;

            case ReconcileStrategy.ManualMergeFields:
                _sourceData = Clone();
                break;
            }

            if (_sourceData != null)
            {
                _sourceData.ReconcileBy = ReconcileStrategy.None;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Reads the json.
        /// </summary>
        /// <param name="obj">The object.</param>
        public virtual void ReadJson(JObject obj)
        {
            ReadIdAndRev(this, obj);

            if (ReconcileBy == ReconcileStrategy.None)
            {
                return;
            }
            var constructorInfo = GetType().GetConstructor(Type.EmptyTypes);

            if (constructorInfo == null)
            {
                return;
            }
            _sourceData = (BigDDocument)constructorInfo.Invoke(new object[0]);
            // set this to prevent infinite recursion
            _sourceData.ReconcileBy = ReconcileStrategy.None;
            _sourceData.ReadJson(obj);
        }