예제 #1
0
        internal async Task <FdbDatabase> OpenDatabaseInternalAsync(string databaseName, IKeySubspace subspace, bool readOnly, bool ownsCluster, CancellationToken ct)
        {
            ThrowIfDisposed();
            Contract.NotNullOrEmpty(databaseName, nameof(databaseName));
            Contract.NotNull(subspace, nameof(subspace));

            if (Logging.On)
            {
                Logging.Info(typeof(FdbCluster), "OpenDatabaseAsync", $"Connecting to database '{databaseName}' ...");
            }

            if (ct.IsCancellationRequested)
            {
                ct.ThrowIfCancellationRequested();
            }

            var handler = await m_handler.OpenDatabaseAsync(databaseName, ct).ConfigureAwait(false);

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(typeof(FdbCluster), "OpenDatabaseAsync", $"Connected to database '{databaseName}'");
            }

            return(FdbDatabase.Create(this, handler, databaseName, subspace, null, readOnly, ownsCluster));
        }
예제 #2
0
        internal async Task <FdbDatabase> OpenDatabaseInternalAsync(string databaseName, IFdbSubspace subspace, bool readOnly, bool ownsCluster, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();
            if (string.IsNullOrEmpty(databaseName))
            {
                throw new ArgumentNullException("databaseName");
            }
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }

            if (Logging.On)
            {
                Logging.Info(typeof(FdbCluster), "OpenDatabaseAsync", String.Format("Connecting to database '{0}' ...", databaseName));
            }

            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            var handler = await m_handler.OpenDatabaseAsync(databaseName, cancellationToken).ConfigureAwait(false);

            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(typeof(FdbCluster), "OpenDatabaseAsync", String.Format("Connected to database '{0}'", databaseName));
            }

            return(FdbDatabase.Create(this, handler, databaseName, subspace, null, readOnly, ownsCluster));
        }