Ejemplo n.º 1
0
        /// <summary>
        /// Stores `_rev` field value.
        /// </summary>
        /// <exception cref="ArgumentException">Specified rev value has invalid format.</exception>
        public static Dictionary <string, object> Rev(this Dictionary <string, object> dictionary, string rev)
        {
            if (!ADocument.IsRev(rev))
            {
                throw new ArgumentException("Specified rev value (" + rev + ") has invalid format.");
            }

            SetFieldValue(dictionary, "_rev", rev);

            return(dictionary);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves value of `_rev` field. If the field is missing or has invalid format null value is returned.
        /// </summary>
        public static string Rev(this Dictionary <string, object> dictionary)
        {
            string rev;

            try
            {
                rev = String(dictionary, "_rev");

                if (!ADocument.IsRev(rev))
                {
                    rev = null;
                }
            }
            catch (Exception)
            {
                rev = null;
            }

            return(rev);
        }