Linq2Couchbase 1.4.0

The official Linq provider for Couchbase N1QL

The official Language Integrated Query (LINQ) provider for querying Couchbase Server with N1QL using the Couchbase .NET 2.6 SDK and Couchbase Server 5.5.0

Install-Package Linq2Couchbase -Version 1.4.0
dotnet add package Linq2Couchbase --version 1.4.0
paket add Linq2Couchbase --version 1.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Linq2Couchbase

Join the chat at https://gitter.im/couchbaselabs/Linq2Couchbase
Build status

The official Language Integrated Query (LINQ) provider for querying Couchbase Server 4.0 with N1QL using the Couchbase .NET SDK. The goal of Linq2Couchbase is to create a lightweight ORM/ODM for querying Couchbase Buckets using LINQ as the lingua-franca between your application and Couchbase Server 4.0 using N1QL, a SQL-like query language for JSON documents. It also provides a write API for performing CRUD operations on JSON documents.

Getting started

The Linq2Couchbase project has the following dependencies:

  • Couchbase Server 4.0 or greater with the query service enabled on at least one node
  • Couchbase .NET SDK 2.3.10 or greater
  • Common.Logging 3.3.1 or greater
  • Common.Logging.Core 3.3.1 or greater
  • JSON.NET 9.0.1 or greater
  • re-linq 2.1.1

If you are using NuGet, then the dependencies (other than Couchbase server) will be installed for you via the package manager.

Installing Couchbase Server

For a single instance of Couchbase server running on localhost, you can download one here (make sure it's 4.0). If you would like to create a cluster, the easiest way is by using the Vagrant scripts for provisioning clusters can be found here. Additionally, Docker scripts can be found here. Following the directions on each respective link for installation information.

Installing the package using NuGet

Once you have a Couchbase Server 4.0 instance or cluster setup, open Visual Studio 13 or greater or MonoDevelop and create an MVC Web Application. Open the NuGet Package Manager and search for "Couchbase Linq" or type the following into the Package Manager console:

Install-Package Linq2Couchbase

NuGet will install the package and all dependencies. Once you have the resolved the dependencies, you will initialize a ClusterHelper object which will manage the bucket resources needed by the Linq provider.

Quick Start

Query the 'travel-sample' bucket and return 10 airlines in any order:

ClusterHelper.Initialize(new ClientConfiguration
{
     Servers = new List<Uri> {new Uri("http://localhost:8091/")}
});

var context = new BucketContext(ClusterHelper.GetBucket("travel-sample"));
var query = (from a in context.Query<AirLine>()
		     where a.Country == "United Kingdom"
		     select a).
		     Take(10);

query.ToList().ForEach(Console.WriteLine);
ClusterHelper.Close();

Full code list available [here](https://gist.github.com/jeffrymorris/c3bf85d73a1e7dfcc5f25f4e581d689a "Linq2Couchbase quick start!").

Developer Guide

Building From Source

Linq2Couchbase uses the NuGet package manager for handling dependencies. To build from the source, simply clone the GitHub repository and build in Visual Studio. The NuGet package manager should download all required dependencies.

Project management

The jira project is here - you can file bugs, propose features or get an idea for the roadmap there. List of supported and proposed N1QL features can be found here.

Contributors

Linq2Couchbase is an open source project and community contributions are welcome whether they be pull-requests, feedback or filing bug tickets or feature requests. We appreciate any contribution no matter how bug or small! If you do decide to contribute, please browse the Jira project and ensure that that feature or issue hasn't already been documented. If you want to work on a feature, bug or whatever please create or select a ticket and set the status to "in-progress".

Linq2Couchbase

Join the chat at https://gitter.im/couchbaselabs/Linq2Couchbase
Build status

The official Language Integrated Query (LINQ) provider for querying Couchbase Server 4.0 with N1QL using the Couchbase .NET SDK. The goal of Linq2Couchbase is to create a lightweight ORM/ODM for querying Couchbase Buckets using LINQ as the lingua-franca between your application and Couchbase Server 4.0 using N1QL, a SQL-like query language for JSON documents. It also provides a write API for performing CRUD operations on JSON documents.

Getting started

The Linq2Couchbase project has the following dependencies:

  • Couchbase Server 4.0 or greater with the query service enabled on at least one node
  • Couchbase .NET SDK 2.3.10 or greater
  • Common.Logging 3.3.1 or greater
  • Common.Logging.Core 3.3.1 or greater
  • JSON.NET 9.0.1 or greater
  • re-linq 2.1.1

If you are using NuGet, then the dependencies (other than Couchbase server) will be installed for you via the package manager.

Installing Couchbase Server

For a single instance of Couchbase server running on localhost, you can download one here (make sure it's 4.0). If you would like to create a cluster, the easiest way is by using the Vagrant scripts for provisioning clusters can be found here. Additionally, Docker scripts can be found here. Following the directions on each respective link for installation information.

Installing the package using NuGet

Once you have a Couchbase Server 4.0 instance or cluster setup, open Visual Studio 13 or greater or MonoDevelop and create an MVC Web Application. Open the NuGet Package Manager and search for "Couchbase Linq" or type the following into the Package Manager console:

Install-Package Linq2Couchbase

NuGet will install the package and all dependencies. Once you have the resolved the dependencies, you will initialize a ClusterHelper object which will manage the bucket resources needed by the Linq provider.

Quick Start

Query the 'travel-sample' bucket and return 10 airlines in any order:

ClusterHelper.Initialize(new ClientConfiguration
{
     Servers = new List<Uri> {new Uri("http://localhost:8091/")}
});

var context = new BucketContext(ClusterHelper.GetBucket("travel-sample"));
var query = (from a in context.Query<AirLine>()
		     where a.Country == "United Kingdom"
		     select a).
		     Take(10);

query.ToList().ForEach(Console.WriteLine);
ClusterHelper.Close();

Full code list available [here](https://gist.github.com/jeffrymorris/c3bf85d73a1e7dfcc5f25f4e581d689a "Linq2Couchbase quick start!").

Developer Guide

Building From Source

Linq2Couchbase uses the NuGet package manager for handling dependencies. To build from the source, simply clone the GitHub repository and build in Visual Studio. The NuGet package manager should download all required dependencies.

Project management

The jira project is here - you can file bugs, propose features or get an idea for the roadmap there. List of supported and proposed N1QL features can be found here.

Contributors

Linq2Couchbase is an open source project and community contributions are welcome whether they be pull-requests, feedback or filing bug tickets or feature requests. We appreciate any contribution no matter how bug or small! If you do decide to contribute, please browse the Jira project and ensure that that feature or issue hasn't already been documented. If you want to work on a feature, bug or whatever please create or select a ticket and set the status to "in-progress".

Version History

Version Downloads Last updated
1.4.0 3,872 8/28/2018
1.4.0-beta 782 5/24/2018
1.3.4 49,602 2/28/2018
1.3.3 38,556 9/25/2017
1.3.2 6,586 6/2/2017
1.2.1 3,982 10/17/2016
1.2.0 7,044 7/8/2016
1.1.0.2 2,353 4/7/2016
1.0.2 2,750 10/27/2015