コード例 #1
0
        /// <summary>Checks that a key is inside the global namespace of this database, and contained in the optional legal key space specified by the user</summary>
        /// <param name="db">Database instance</param>
        /// <param name="key">Key to verify</param>
        /// <param name="endExclusive">If true, the key is allowed to be one past the maximum key allowed by the global namespace</param>
        /// <exception cref="FdbException">If the key is outside of the allowed keyspace, throws an FdbException with code FdbError.KeyOutsideLegalRange</exception>
        internal static void EnsureKeyIsValid([NotNull] this IFdbDatabase db, ref Slice key, bool endExclusive = false)
        {
            Exception ex;

            if (!FdbDatabase.ValidateKey(db, ref key, endExclusive, false, out ex))
            {
                throw ex;
            }
        }
コード例 #2
0
 /// <summary>Checks that one or more keys are inside the global namespace of this database, and contained in the optional legal key space specified by the user</summary>
 /// <param name="db">Database instance</param>
 /// <param name="keys">Array of keys to verify</param>
 /// <param name="endExclusive">If true, the keys are allowed to be one past the maximum key allowed by the global namespace</param>
 /// <exception cref="FdbException">If at least on key is outside of the allowed keyspace, throws an FdbException with code FdbError.KeyOutsideLegalRange</exception>
 internal static void EnsureKeysAreValid([NotNull] this IFdbDatabase db, Slice[] keys, bool endExclusive = false)
 {
     Contract.NotNull(keys, nameof(keys));
     for (int i = 0; i < keys.Length; i++)
     {
         Exception ex;
         if (!FdbDatabase.ValidateKey(db, ref keys[i], endExclusive, false, out ex))
         {
             throw ex;
         }
     }
 }
コード例 #3
0
 /// <summary>Checks that one or more keys are inside the global namespace of this database, and contained in the optional legal key space specified by the user</summary>
 /// <param name="db">Database instance</param>
 /// <param name="keys">Array of keys to verify</param>
 /// <param name="endExclusive">If true, the keys are allowed to be one past the maximum key allowed by the global namespace</param>
 /// <exception cref="FdbException">If at least on key is outside of the allowed keyspace, throws an FdbException with code FdbError.KeyOutsideLegalRange</exception>
 internal static void EnsureKeysAreValid(this IFdbDatabase db, Slice[] keys, bool endExclusive = false)
 {
     if (keys == null)
     {
         throw new ArgumentNullException("keys");
     }
     for (int i = 0; i < keys.Length; i++)
     {
         Exception ex;
         if (!FdbDatabase.ValidateKey(db, ref keys[i], endExclusive, false, out ex))
         {
             throw ex;
         }
     }
 }
コード例 #4
0
        public static bool IsKeyValid([NotNull] this IFdbDatabase db, Slice key)
        {
            Exception _;

            return(FdbDatabase.ValidateKey(db, ref key, false, true, out _));
        }