August 12th, 2014

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:

And for a given .NET class:

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.

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


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

New features in the DataStax C# Driver 2.1” was created by Jorge Bay Gondra