New features in the DataStax C# Driver 2.1

By Jorge Bay Gondra -  August 12, 2014 | 4 Comments

Following the announcement of the Python driver 2.1, we're pleased to announce today the release of the version 2.1 of the DataStax C# driver, that brings support for the new features in Cassandra 2.1 while maintaining compatibility with previous versions of Cassandra (1.2+).

Let’s quickly walk through some of new features in the C# driver.

User defined type mapping

A major new feature for CQL coming in Cassandra 2.1 is the ability to create User Defined Types (or UDT for short).

UDTs are a structured composition of fields. Take a list of addresses for example. A user can have a limited amount of addresses in their user account but addresses are more than just a text field, it can have street name, number, city, postal code, etc.

With the C# driver, you can map your User Defined Types to classes defined in your application (POCOs, no attribute decoration required).
For example, given the following UDT:

CREATE TYPE address (
   street text,
   city text,
   zip int);

And for a given .NET class:

public class Address
   public string Street { get; set; }
   public string City { get; set; }
   public int Zip { get; set; }

You can define a mapping at Session level:


You can map class properties to UDT fields automatically or manually and even have nested UDT mapping. You can see the UDT mapping documentation here.

Named parameter support

Previously, it was only possible to bind the parameters in a BoundStatement or SimpleStatement by marker position.

var statement = session.Prepare("SELECT * FROM table where a = ? and b = ?");
// Bind parameter by marker position 
session.Execute(statement.Bind("aValue", "bValue"));

Now, while this notation is still valid, you can declare the named markers in your queries and use as parameter names when binding.

var statement = session.Prepare("SELECT * FROM table where a = :a and b = :b"); 
// Bind by name using anonymous types 
session.Execute(statement.Bind( new { a = "aValue", b = "bValue" }));

Protocol changes in Cassandra 2.1

One of the most noteworthy changes in the new version of the Cassandra native protocol is the header changes allowing a larger number of requests without waiting for a response.
The 2.1 version of the C# driver supports the new native protocol and enabling it to use a smaller number of connections per host when used under heavy concurrency.

Final notes

We added more than 100 new unit and integration tests since 2.0, for the new features and to add more coverage existing functionality.
There is a significant performance improvement in the latest release for high number of parallel requests, I will explain what we did and what to expect from it in another blog post.

The new 2.1 version of the C# Driver is now available on NuGet:
The source code is available on GitHub:

Here are some additional resource to help you get started

DataStax has many ways for you to advance in your career and knowledge.

You can take free classes, get certified, or read one of our many white papers.

register for classes

get certified

DBA's Guide to NoSQL


  1. Asaf says:

    What about a node.js driver ?

    The existing clients are barely maintained.

  2. The DataStax Node.js is coming, we will be able to give you further detail in the following weeks.

  3. Raj says:

    Documentation seems not moderated as I have identified issue. Please check documents before it goes to public.

  4. @Raj
    Did u find an issue on the doc? Could you detail so we can fix it?


Your email address will not be published. Required fields are marked *

Subscribe for newsletter:

Tel. +1 (408) 933-3120 Offices France GermanyJapan

DataStax Enterprise is powered by the best distribution of Apache Cassandra™.

© 2017 DataStax, All Rights Reserved. DataStax, Titan, and TitanDB are registered trademark of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache Cassandra, Apache, Tomcat, Lucene, Solr, Hadoop, Spark, TinkerPop, and Cassandra are trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.