コード例 #1
0
        /// <summary>
        /// Send a request for creating a database.
        ///
        /// A database manages users, permissions and a set of containers.
        /// Each Azure Cosmos DB Database Account is able to support multiple independent named databases,
        /// with the database being the logical container for data.
        ///
        /// Each Database consists of one or more containers, each of which in turn contain one or more
        /// documents. Since databases are an administrative resource, the Service Master Key will be
        /// required in order to access and successfully complete any action using the User APIs.
        /// </summary>
        /// <param name="id">The database id.</param>
        /// <param name="throughput">(Optional) The throughput provisioned for a collection in measurement of Requests-per-Unit in the Azure Cosmos DB service.</param>
        /// <param name="requestOptions">(Optional) A set of options that can be set.</param>
        /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param>
        /// <returns>A <see cref="Task"/> containing a <see cref="CosmosDatabaseResponse"/> which wraps a <see cref="CosmosDatabaseSettings"/> containing the resource record.</returns>
        public virtual Task <CosmosDatabaseResponse> CreateDatabaseAsync(
            string id,
            int?throughput = null,
            CosmosRequestOptions requestOptions = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            CosmosDatabaseSettings databaseSettings = CosmosDatabases.PrepareCosmosDatabaseSettings(id);

            return(CreateDatabaseAsync(
                       databaseSettings,
                       throughput,
                       requestOptions,
                       cancellationToken));
        }
コード例 #2
0
 internal virtual Task <CosmosDatabaseResponse> CreateDatabaseAsync(
     CosmosDatabaseSettings databaseSettings,
     int?throughput = null,
     CosmosRequestOptions requestOptions = null,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return(CosmosDatabases.CreateDatabaseCoreAsync(
                databaseSettings,
                this.client,
                response => this.client.ResponseFactory.CreateDatabaseResponse(
                    response,
                    new CosmosDatabase(this.client, databaseSettings.Id)),
                requestOptions,
                throughput,
                cancellationToken));
 }