Migrate C# driver
Complete the following procedure to migrate your existing DataStax C# driver to a version that is capable of connecting to Astra databases created using DataStax Astra.
Prerequisites
-
Create a database using DataStax Astra.
-
Download the secure connect bundle to obtain connection credentials for your DataStax Astra database.
-
Get 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. |
Procedure
-
Add the dependencies for the C# driver to your project.
-
In your existing DataStax C# driver code, modify the connection code to use the DataStax Astra API.
Include the absolute path to the secure connect bundle for your Cassandra database (
secure-connect-database_name.zip
) in theWithCloudSecureConnectionBundle
method call, and your credentials in theWithCredentials
method call, as shown in the following examples.var session = Cluster.Builder() .WithCloudSecureConnectionBundle(@"C:\path\to\secure-connect-database_name.zip") .WithCredentials("clientId", "clientSecret") .Build() .Connect();
var session = DseCluster.Builder() .WithCloudSecureConnectionBundle(@"C:\path\to\secure-connect-database_name.zip") .WithCredentials("clientId", "clientSecret") .Build() .Connect();
-
Run your application.