page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
Azure Cosmos DB is Microsoft's globally distributed multi-model database service |
azure-cosmos-db-cassandra-dotnet-getting-started |
Developing a Dotnet app with Cassandra API using Azure Cosmos DB
Azure Cosmos DB is Microsoft's globally distributed multi-model database service. You can quickly create and query document, table, key-value, and graph databases, all of which benefit from the global distribution and horizontal scale capabilities at the core of Azure Cosmos DB. This quick start demonstrates how to create an Azure Cosmos DB account for the Cassandra API by using the Azure portal. You'll then build a user profile console app, output as shown in the following image, with sample data.
Running this sample
- Before you can run this sample, you must have the following perquisites:
- An active Azure Cassandra API account - If you don't have an account, refer to the Create Cassandra API account.
- Microsoft Visual Studio.
- Git.
-
Clone this repository using
git clone https://github.com/Azure-Samples/azure-cosmos-db-cassandra-dotnet-getting-started.git
-
Open the CassandraQuickStartSample.sln solution and install the Cassandra .NET driver. Use the .NET Driver's NuGet package. From the Package Manager Console window in Visual Studio:
PM> Install-Package CassandraCSharpDriver
- Next, configure the endpoints in Program.cs
private const string UserName = "<FILLME>";
private const string Password = "<FILLME>";
private const string CassandraContactPoint = "<FILLME>"; // DnsName
-
Compile and Run the project.
-
Output Image:
About the code
The code included in this sample is intended to get you quickly started with a C# application using Cassandra C# driver that connects to Azure Cosmos DB with the Cassandra API.