Last week, we released DataStax Enterprise (DSE) 5.0 and, to support the additional features of the platform, we announced the availability of a new set of drivers .
The DataStax Enterprise C# Driver
is a new package
that depends on the “core” C# driver
for Apache Cassandra, exposing new dedicated interfaces
, which inherit from
interfaces respectively, to provide additional capabilities likeDSE Graph support, Unified Authentication
and Geospatial types support.
Upgrading from the Core Driver
To Upgrade from CassandraCSharpDriver, change your dependency to the new Dse package
, add the
IDseCluster cluster = DseCluster.Builder() .AddContactPoint("127.0.0.1") .Build(); IDseSession session = cluster.Connect();
For clients connecting to a cluster secured with DSE Unified Authentication , two authentication providers are included:
You can specify the authentication provider when initializing the cluster:
using Dse; using Dse.Auth;
IDseCluster dseCluster = DseCluster.Builder() .AddContactPoint("127.0.0.1") .WithAuthProvider(new DseGssapiAuthProvider()) .Build();
DSE Graph Support
method to execute graph queries:
GraphResultSet rs = session.ExecuteGraph("g.V()"); Vertex vertex = rs.First(); Console.WriteLine(vertex.Label);
There is also a non-blocking method counterpart,
which returns a
that can be awaited on.
DataStax Enterprise 5.0 comes with a set of additional CQL types to represent geospatial data:
cqlsh> CREATE TABLE points_of_interest(name text PRIMARY KEY, coords 'PointType'); cqlsh> INSERT INTO points_of_interest (name, coords) VALUES ('Eiffel Tower', 'POINT(48.8582 2.2945)');
The DSE driver includes C# representations of these types in the
namespace that can be used directly as parameters in queries. All C# geospatial types implement
, that returns the string representation in Well-known text format
Row row = session.Execute("SELECT coords FROM points_of_interest WHERE name = 'Eiffel Tower'").First(); Point coords = row.GetValue<Point>("coords"); var statement = new SimpleStatement("INSERT INTO points_of_interest (name, coords) VALUES (?, ?)", "Washington Monument", new Point(38.8895, 77.0352)); session.Execute(statement);
See the driver documentation on geospatial types for more details.
We will continue to develop and improve the C# driver for Apache Cassandra as it represents the core building block on which DataStax Enterprise C# Driver is built, and also continue to add DSE-specific functionalities in this new driver.
To provide feedback use the following:
- Mailing list
- IRC: #datastax-drivers on irc.freenode.net
- Review and contribute source code on GitHub: datastax/csharp-driver and datastax/csharp-driver-dse
- Report issues on JIRA
Note that the DataStax Enterprise C# Driver is published under specific license terms that allow its usage only in conjunction with DataStax Enterprise software .