Migrating the C# driver to connect with Apollo databases

Migrate your existing DataStax C# driver to a version compatible with Cassandra databases.

Complete the following procedure to migrate your existing DataStax C# driver to a version that is capable of connecting to Apollo databases created using DataStax Apollo.

Prerequisites

  1. Create a DataStax Apollo database.
  2. Download the secure connect bundle to obtain connection credentials for your DataStax Apollo database.

Procedure

  1. Add the dependencies for the C# driver to your project.
    • DataStax C# driver for Apache Cassandra

      dotnet add package CassandraCSharpDriver -v 3.12.0
    • DSE C# driver

      dotnet add package Dse -v 2.9.0
  2. In your existing DataStax C# driver code, modify the connection code to use the DataStax Apollo API.
    Note: Include the absolute path to the secure connect bundle for your Cassandra 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.
    • DataStax C# driver for Apache Cassandra

      var session = 
        Cluster.Builder()
            .WithCloudSecureConnectionBundle(@"C:\path\to\secure-connect-database_name.zip")
            .WithCredentials("username", "password")
            .Build()
            .Connect();
    • DSE C# driver

      var session = 
        DseCluster.Builder()
            .WithCloudSecureConnectionBundle(@"C:\path\to\secure-connect-database_name.zip")
            .WithCredentials("username", "password")
            .Build()
            .Connect();
  3. Run your application.