Table of Contents

Class DatabaseProperties

Namespace
Microsoft.Azure.Cosmos
Assembly
Microsoft.Azure.Cosmos.Client.dll

Represents a database in the Azure Cosmos DB account.

public class DatabaseProperties
Inheritance
DatabaseProperties
Inherited Members
Extension Methods

Examples

The example below creates a new Database with an Id property of 'MyDatabase'.

using (CosmosClient client = new CosmosClient("connection string"))
{
    DatabaseProperties db1 = await client.CreateDatabaseAsync("MyDatabase");
}

Remarks

Each Azure Cosmos DB database account can have zero or more databases. A database in Azure Cosmos DB is a logical container for document collections and users. Refer to https://docs.microsoft.com/azure/cosmos-db/databases-containers-items#databases for more details on databases.

Constructors

DatabaseProperties()

Initializes a new instance of the DatabaseProperties class for the Azure Cosmos DB service.

public DatabaseProperties()

DatabaseProperties(string)

Initializes a new instance of the DatabaseProperties class for the Azure Cosmos DB service.

public DatabaseProperties(string id)

Parameters

id string

The Id of the resource in the Azure Cosmos service.

Properties

ETag

Gets the entity tag associated with the resource from the Azure Cosmos DB service.

public string ETag { get; }

Property Value

string

The entity tag associated with the resource.

Remarks

ETags are used for concurrency checking when updating resources.

Id

Gets or sets the Id of the resource in the Azure Cosmos DB service.

public string Id { get; set; }

Property Value

string

The Id associated with the resource.

Remarks

Every resource within an Azure Cosmos DB database account needs to have a unique identifier.

The following characters are restricted and cannot be used in the Id property: '/', '\\', '?', '#'

LastModified

Gets the last modified time stamp associated with DatabaseProperties from the Azure Cosmos DB service.

public DateTime? LastModified { get; }

Property Value

DateTime?

The last modified time stamp associated with the resource.

Gets the self-link associated with the resource from the Azure Cosmos DB service.

public string SelfLink { get; }

Property Value

string

The self-link associated with the resource.

A self-link is a static addressable Uri for each resource within a database account and follows the Azure Cosmos DB resource model. E.g. a self-link for a document could be dbs/db_resourceid/colls/coll_resourceid/documents/doc_resourceid