Skip to content
Couchbase .NET client library (official), based on the Enyim memcached client
C# Shell
Find file
New pull request
Latest commit db07eb1 @brantburnett brantburnett committed with jeffrymorris Support for more deserialization controls via ITypeSerializers
The current ITypeSerializer implementation works under the assumption that
all serialization/deserialization requests should have the same behavior.
Any client library which implements a custom ITypeSerializer overrides
this behavior for all requests to Couchbase.

However, there are instances where a specific request may require custom
options.  The particular example addressed here is change tracking in the
Linq2Couchbase library.  It needs to control the object creation process
for some deserialization requests in order to create change tracking

Additionally, we need a method for custom ITypeSerializer implementations
to provide member name resolution information to consumers.  This will
allow Linq2Couchbase to determine the correct attribute names to use when
building N1QL queries.  Currently, it is forced to assume that the
Newtonsoft.Json behavior is in use.

Finally, there is currently no method to override the deserialization
process for N1QL queries on a per-request basis.

Created a new interface which extends ITypeSerializer named

Added GetMemberName method to IExtendedTypeSerializer, which provides
member name resolution information to consumers.

Added DeserializationOptions to IExtendedTypeSerializer, which allows
consumers to set the options they'd like.  Currently, this object supports
only one option, CustomTypeCreator, which allows the consumer to override
the type creation process on a type-by-type basis.

Also provided a SupportedDeserializationOptions object.  This allows the
IExtendedTypeSerializer to define which options it does or does not

Updated the DefaultSerializer to support all of the new interfaces,
methods, and options provided.

Additionally, created a new interface IQueryRequestWithMapper, inherited
form IQueryRequest, which adds a DataMapper to IQueryRequest.  Added this
interface to the default QueryRequest implentation.  This allows the data
mapper used for N1QL queries can be customized on a per-request basis.

For users using the DefaultSerializer based on Newtonsoft.Json, they will
immediately have access to the new features on IExtendedTypeSerializer.
This includes a method to resolve member names, and the ability to
override the type creation process.  This will allow Linq2Couchbase to
transparently implement change tracking proxies.

For projects using a custom ITypeSerializer implementation, consumers such
as Linq2Couchbase can detect support for advanced features by testing for
the IExtendedTypeSerializer interface.  If present, they can then test for
specific features via the SupportedDeserializationOptions property.

Backwards compatibility is fully maintained by these changes.
Additionally, the use of SupportedDeserializationOptions will allow the
addition of more deserialization options in the future without creating
backwards compatibility issues.

Change-Id: I60db3a6a93d787d9e5e48ed1984e7b31566d348e
Reviewed-by: Jeffry Morris <>
Tested-by: Jeffry Morris <>

Official Couchbase .NET SDK

  • master is 2.0 development branch
  • release13 is 1.3.X development branch

Running the Unit Tests

To run the unit tests (for master), the following are required:

  1. Couchbase Server >= 3.0 installed on localhost
  2. N1QL DP4 downloaded, copied to disk and connected to your localhost Couchbase Server: see here.
  3. The "beer-sample" sample Bucket and data set installed. This can be installed by logging into the Couchbase Console (http://localhost:8091) and then Settings->Sample Buckets.
  4. The following buckets installed on localhost:
    1. "default" - the standard default bucket
    2. "authenticated" - a Couchbase bucket with a password of "secret"
    3. "memcached" - a Memcached bucket with no password
  5. Install an SSL certificate (copied from the Couchbase console) if you wish to run the SSL/TLS tests

Note that some tests require a cluster (Observe tests and Replica Read tests for example) and will fail if running on localhost.

Pull Requests and Submissions

Being an Open Source project, the Couchbase SDK depends upon feedback and submissions from the community. If you feel as if you want to submit a bug fix or a feature, please post a Pull Request. The Pull Request will go through a formal code review process and merged after being +2'd by a Couchbase Engineer. In order to accept a submission, Couchbase requires that all contributors sign the Contributor License Agreement (CLA). You can do this by creating an account in Gerrit, our official Code Review system. After you have created your account, login and check the CLA checkbox.

Once the CLA is signed, a Couchbase engineer will push the pull request to Gerrit and one or more Couchbase engineers will review the submission. If it looks good they will then +2 the changeset and merge it with master. In addition, if the submission needs more work, you will need to amend the Changeset with another Patchset. Note that is strongly encouraged to submit a Unit Test with each submission and also include a description of the submission, what changed and what the result is.

Something went wrong with that request. Please try again.