Use the unified DataStax C# driver to connect to your DataStax Astra DB database and begin building your own application.
DataStax recommends using the unified DataStax C# driver.If you have an existing Apache Cassandra or DataStax Enterprise (DSE) C# driver, migrate the driver to a version that is capable of connecting to Astra DB databases.
- Download and install the current version of the .NET Core SDK.
- Download the secure connect bundle to obtain connection credentials for your Astra DB database.
- Your Client ID_ and _Client Secret by creating your application token for your username and password.
Alternatively, have a teammate provide access to their Astra database.
- Create a new C# project and configure it to connect to your Cassandra database.
- 1
- Add the dependencies for the C# driver to your project.
- 1
- Replace the code in Program.cs with the following code to connect to your Astra DB database.
Include the absolute path to the secure connect bundle for your Astra DB database ( secure-connect-database_name.zip ) in the WithCloudSecureConnectionBundle method call, and your credentials in the WithCredentials method call, as shown in the following examples.
- 1
- After the connection code, add the following code to the Main method in Program.cs . This code runs a CQL query, and prints the output to the console.
- 1
- Run your C# project with the dotnet runtime.
- 1