MyCouch 5.1.0
MyCouch is a simple async CouchDB client building on top of the async HTTP client and uses JSON.Net to provide flexible serialization behaviour. It tries to keep the domain language of CouchDB and lets you work with requests and responses but also provides you with an alternative simplifying async API. MyCouch lets you work with raw JSON and/or entities/POCOS without requiring any implementation of interfaces or base-classes etc.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
Install-Package MyCouch -Version 5.1.0
dotnet add package MyCouch --version 5.1.0
<PackageReference Include="MyCouch" Version="5.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MyCouch --version 5.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Quick sample - using Requests and Responses
using(var client = new MyCouchClient("http://localhost:5984/", "mydb"))
{
//POST with server generated id
await client.Documents.PostAsync("{\"name\":\"Daniel\"}");
//POST with client generated id - possible but wrong
await client.Documents.PostAsync("{\"_id":\"someId", \"name\":\"Daniel\"}");
//PUT for client generated id
await client.Documents.PutAsync("someId", "{\"name\":\"Daniel\"}");
//PUT for updates
await client.Documents.PutAsync("someId", "docRevision", "{\"name\":\"Daniel Wertheim\"}");
//PUT for updates with _rev in JSON
await client.Documents.PutAsync("someId", "{\"_rev\": \"docRevision\", \"name\":\"Daniel Wertheim\"}");
//Using entities
var me = new Person {Id = "SomeId", Name = "Daniel"};
await client.Entities.PutAsync(me);
//Using anonymous entities
await client.Entities.PostAsync(new { Name = "Daniel" });
}
using(var client = new MyCouchServerClient("http://localhost:5984"))
{
var r = await client.Replicator.ReplicateAsync(id, source, target);
}
Quick sample - using MyCouchStore
using(var store = new MyCouchStore("http://localhost:5984", "mydb"))
{
var mySomething = await store.StoreAsync(new Something("foo", "bar", 42));
var retrieved = await store.GetByIdAsync(mySomething.Id);
var deleted = await store.DeleteAsync(mySomething.Id, mySomething.Rev);
//... ... and so on... ...
}
Quick sample - using Requests and Responses
using(var client = new MyCouchClient("http://localhost:5984/", "mydb"))
{
//POST with server generated id
await client.Documents.PostAsync("{\"name\":\"Daniel\"}");
//POST with client generated id - possible but wrong
await client.Documents.PostAsync("{\"_id":\"someId", \"name\":\"Daniel\"}");
//PUT for client generated id
await client.Documents.PutAsync("someId", "{\"name\":\"Daniel\"}");
//PUT for updates
await client.Documents.PutAsync("someId", "docRevision", "{\"name\":\"Daniel Wertheim\"}");
//PUT for updates with _rev in JSON
await client.Documents.PutAsync("someId", "{\"_rev\": \"docRevision\", \"name\":\"Daniel Wertheim\"}");
//Using entities
var me = new Person {Id = "SomeId", Name = "Daniel"};
await client.Entities.PutAsync(me);
//Using anonymous entities
await client.Entities.PostAsync(new { Name = "Daniel" });
}
using(var client = new MyCouchServerClient("http://localhost:5984"))
{
var r = await client.Replicator.ReplicateAsync(id, source, target);
}
Quick sample - using MyCouchStore
using(var store = new MyCouchStore("http://localhost:5984", "mydb"))
{
var mySomething = await store.StoreAsync(new Something("foo", "bar", 42));
var retrieved = await store.GetByIdAsync(mySomething.Id);
var deleted = await store.DeleteAsync(mySomething.Id, mySomething.Rev);
//... ... and so on... ...
}
Release Notes
https://github.com/danielwertheim/mycouch/wiki/release-notes
Dependencies
-
.NETFramework 4.5.1
- Ensure.That (>= 7.1.0)
- Newtonsoft.Json (>= 10.0.3)
-
.NETStandard 1.1
- Ensure.That (>= 7.1.0)
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 10.0.3)
- System.Reflection.Emit.Lightweight (>= 4.3.0)
-
.NETStandard 2.0
- Ensure.That (>= 7.1.0)
- Newtonsoft.Json (>= 10.0.3)
- System.Reflection.Emit.Lightweight (>= 4.3.0)
Used By
NuGet packages (11)
Showing the top 5 NuGet packages that depend on MyCouch:
Package | Downloads |
---|---|
PMoney.Inventory
Consumes a generic inventory document store to be used in PMoney applications.
|
|
MyCouch.Cloudant
MyCouch is the simple asynchronous CouchDB and Cloudant client for .Net - building on top of the asynchronous HTTP client and uses JSON.Net to provide flexible serialization behaviour.
This package contains support for Cloudant specific features. If you want pure CouchDB support go with the "MyCouch" package instead.
It tries to keep the domain language of Cloudant and CouchDB and lets you work with requests and responses but also provides you with an alternative simplifying async API. MyCouch lets you work with raw JSON and/or entities/POCOS without requiring any implementation of interfaces or base-classes etc, and it provides you with some model conventions like injection of $doctype to the document.
|
|
PMoney.Customers
Consumes a generic Customers document store to be used in PMoney applications.
|
|
InventorySDK
Consumes a generic inventory document store to be used in PMoney applications.
|
|
MyCouch.AspNet.Identity
A simple implementation of the new ASP.Net identity provider model for handling authentication and authorization in e.g. ASP.Net MVC5 using CouchDb or Cloudant as storage.
|
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on MyCouch:
Repository | Stars |
---|---|
HofmeisterAn/dotnet-testcontainers
A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
|
Version History
Version | Downloads | Last updated |
---|---|---|
7.5.0 | 288 | 12/24/2020 |
7.4.0 | 2,414 | 9/17/2020 |
7.3.0 | 1,131 | 8/20/2020 |
7.2.1 | 12,641 | 4/15/2020 |
7.2.0 | 13,618 | 12/22/2019 |
7.1.1 | 6,868 | 11/16/2019 |
7.1.0 | 13,311 | 4/12/2019 |
7.0.0 | 451 | 4/12/2019 |
6.0.0 | 26,579 | 4/29/2018 |
5.1.1 | 2,818 | 3/19/2018 |
5.1.0 | 629 | 3/16/2018 |
5.0.3 | 8,921 | 11/19/2017 |
5.0.3-pre19 | 485 | 11/19/2017 |
5.0.3-pre18 | 481 | 11/19/2017 |
5.0.2 | 1,913 | 10/4/2017 |
5.0.1 | 7,526 | 6/29/2017 |
5.0.1-pre9 | 557 | 5/18/2017 |
5.0.0-pre5 | 998 | 4/2/2017 |
4.0.0 | 39,631 | 11/25/2015 |
4.0.0-rc6 | 753 | 11/15/2015 |
4.0.0-rc5 | 697 | 11/14/2015 |
4.0.0-rc4 | 730 | 11/9/2015 |
4.0.0-rc3 | 730 | 11/8/2015 |
4.0.0-rc2 | 711 | 11/8/2015 |
4.0.0-rc1 | 821 | 10/13/2015 |
3.2.0 | 13,726 | 5/1/2015 |
3.1.1 | 837 | 4/24/2015 |
3.1.0 | 6,707 | 2/18/2015 |
3.0.0 | 1,814 | 12/29/2014 |
2.6.0 | 1,834 | 10/21/2014 |
2.5.0 | 746 | 10/14/2014 |
2.4.2 | 741 | 10/11/2014 |
2.4.1 | 845 | 9/18/2014 |
2.4.0 | 862 | 9/6/2014 |
2.3.0 | 713 | 9/1/2014 |
2.2.2 | 748 | 8/26/2014 |
2.2.1 | 1,013 | 6/18/2014 |
2.2.0 | 688 | 6/17/2014 |
2.1.1 | 709 | 6/16/2014 |
2.1.0 | 695 | 6/15/2014 |
2.0.0 | 2,483 | 5/18/2014 |
1.0.0 | 950 | 4/16/2014 |