The new “hotness” in the Microsoft .NET world is .NET Core Framework: an open source, cross platform (OSX, Linux, and Windows) implementation of the .NET framework. In an effort to provide the very best developer environment, today Couchbase is releasing a .NET Core compatible SDK! This initial version is a developer preview, and actually supports .NET Framework 4.5 and .NET Core 1.0. More on that later.

What's in this package?

If your following the Couchbase .NET SDK, you'll notice that we bumped the minor version from 2.3.X to 2.4.X in this release. The reason is that final GA version of 2.4.0 will contain several new features which broaden this public facing API of the SDK:

These features are either in development or about to begin development and will make their way into subsequent DP's – this release, DP1, only includes .NET Core compatibility.

Importantly note that this package includes both .NET Framework 4.5 (our base .NET version that the SDK supports) and .NET Core 1.0 (via NetStandard1.5). Your target project type will determine which version of the SDK is used. It also means that the NuGet package will be backwards compatible with your existing code as long as you do not convert your projects to .NET Core projects.

Additionally, there is a high probability that the SDK will not support synchronous methods for the final .NET Core version; this is because Microsoft has been moving away from the older synchronous API's to async everything. You'll still be able to call the async methods synchronously via Task.Result, we just won't offer a pure synchronous version.

Getting Started on Linux

In the following section I will show how to use the Couchbase .NET Core 2.4.0-dp1 in a simple console application running on Ubuntu 14.0.4. I am assuming that you have already installed .NET Core 1.0.1 on the machine, if you haven't please follow these directions. It also assumes you have installed Couchbase Server 4.5. If you haven't please download and install it.

First open, a terminal and make a directory called cb-core-example and then change to that directory and run dotnet new:

Using VIM or your favorite editor, open up the project.json file that was created when you ran dotnet new. Add the dependency to the CouchbaseNetClient package on NuGet get, specifying the correct version (2.4.0-dp1):

Again using VIM or your favorite editor, open up the Program.cs file and enter the following code:

Once you have done this, you'll just do a dotnet restore and dotnet run to update the dependencies and run the application. If everything works out, you should see the words SUCCESS written to the terminal.

Once again, the commands are as follows:

Community Shout Outs

This developer preview was months in the making and included several contributions from the community. A big shout out to Brant Burnett of CenterEdge Software for making core contributions and guidance with packaging and API migrations to Core supported libraries.

Contributing and reporting bugs

The Couchbase .NET SDK is always looking for community contributions and feedback. If you would wish to contribute, the Github repo is here. If you find a bug, create a Jira ticket or do a forums post.

How to get it?

Posted by Jeff Morris, Software Engineer, Couchbase

One Comment

  1. […] Adding direct support for lists, maps, sets, and queues in the sub-document API using the new data structure SDK feature, further simplifies application development. The new data structures work seamlessly with the same underlying data representation, allowing developers in N1QL, Java, .NET, and other languages to access the same data across different programming languages and interfaces.Adding .NET Core support enables Microsoft application developers to easily develop and integrate their applications with Couchbase Server. Check out documentation for Data structures and .NET Core blog. […]

Leave a reply