Пример #1
0
        /// <summary>Removes the directory, its contents, and all subdirectories.
        #endregion

        #region Exists...

        /// <summary>Checks if a directory already exists</summary>
        /// <returns>Returns true if the directory exists, otherwise false.</returns>
        public static Task <bool> ExistsAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, FdbDirectoryPath path, CancellationToken ct)
        {
            Contract.NotNull(directory, nameof(directory));
            Contract.NotNull(db, nameof(db));

            return(db.ReadAsync((tr) => directory.ExistsAsync(tr, path), ct));
        }
        /// <summary>Checks if a directory already exists</summary>
        /// <returns>Returns true if the directory exists, otherwise false.</returns>
        public static Task <bool> ExistsAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, IEnumerable <string> path, CancellationToken ct)
        {
            if (directory == null)
            {
                throw new ArgumentNullException(nameof(directory));
            }
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            return(db.ReadAsync((tr) => directory.ExistsAsync(tr, path), ct));
        }
        /// <summary>Checks if a directory already exists</summary>
        /// <returns>Returns true if the directory exists, otherwise false.</returns>
        public static Task <bool> ExistsAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyTransaction trans, [NotNull] string name)
        {
            if (directory == null)
            {
                throw new ArgumentNullException(nameof(directory));
            }
            if (trans == null)
            {
                throw new ArgumentNullException(nameof(trans));
            }
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            return(directory.ExistsAsync(trans, new[] { name }));
        }
        /// <summary>Checks if a directory already exists</summary>
        /// <returns>Returns true if the directory exists, otherwise false.</returns>
        public static Task <bool> ExistsAsync([NotNull] this IFdbDirectory directory, [NotNull] IFdbReadOnlyRetryable db, [NotNull] string name, CancellationToken cancellationToken)
        {
            if (directory == null)
            {
                throw new ArgumentNullException("directory");
            }
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            return(db.ReadAsync((tr) => directory.ExistsAsync(tr, new[] { name }), cancellationToken));
        }
Пример #5
0
 public Task <bool> ExistsAsync([NotNull] string name, CancellationToken cancellationToken)
 {
     return(m_database.ReadWriteAsync((tr) => m_directory.ExistsAsync(tr, new string[] { name }), cancellationToken));
 }