• This repository has been archived on 17/Sep/2023
  • Stars
    star
    227
  • Rank 175,900 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MyCouch is the asynchronous CouchDB client for .NET

MyCouch

The asynchronous CouchDB client for .NET - builds on top of the asynchronous HTTP client and uses JSON.Net to provide flexible serialization behaviour. It tries to keep the domain language of CouchDB instead of bringing in generic repositories and other confusing stuff. MyCouch lets you work with raw JSON and/or entities/POCOS without requiring any implementation of interfaces, baseclasses etc. MyCouch provides you with some model conventions like injection of $doctype to the document.

Multiple target frameworks: .NET Standard 1.1, .NET Standard 2.0; using a .NET Standard project.

Build Status Nuget

The documentation is contained in the project wiki.

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... ...
}

Integration tests

The ./.env file and ./src/tests/IntegrationTests/integrationtests.local.ini files are .gitignored. In order to create sample files of these, you can run:

. init-local-config.sh

Docker-Compose

There's a docker-compose.yml file, that defines usage of a single node CouchDB over port 5984. The COUCHDB_USER and COUCHDB_PASSWORD is configured via environment key MyCouch_User and MyCouch_Pass; which can either be specified via:

  • Environment variable: MyCouch_User and MyCouch_Pass, e.g.:
MyCouch_User=sample_user
MyCouch_Pass=sample_password
  • Docker Environment file ./.env (.gitignored), e.g.:
MyCouch_User=sample_user
MyCouch_Pass=sample_password

Test configuration

Credentials need to be provided, either via:

  • Local-INI-file (.gitignored): ./src/tests/IntegrationTests/integrationtests.local.ini, e.g.:
User=sample_user
Pass=sample_password
  • Environment variables: MyCouch_User and MyCouch_Pass, e.g.:
MyCouch_User=sample_user
MyCouch_Pass=sample_password

More Repositories

1

Ensure.That

Guard clause project for .NET
C#
439
star
2

SisoDb-Provider

SisoDb - Simple Structure Oriented Db
C#
126
star
3

mynatsclient

C# .NET and .NET Core client for NATS
C#
86
star
4

structurizer

Provide Structurizer with an object graph and it efficiently provides key-values for it.
C#
53
star
5

Kiwi

For embedding your GitHub Wiki locally, i.e in ASP.Net MVC
C#
46
star
6

routemeister

Simple async in process route library.
C#
41
star
7

requester

Requester is a Http-request fiddling magical something that is designed to interact with and help you validate web APIs.
C#
37
star
8

LiteCQRS

My small conventionbased CQRS solution in C#
C#
27
star
9

jsonnet-privatesetterscontractresolvers

Replaced with new repo and NuGets: https://github.com/danielwertheim/jsonnet-contractresolvers
PowerShell
22
star
10

lightnugetserver

Multi feed enabled, self hosted NuGet Server
C#
16
star
11

jsonnet-contractresolvers

Custom contract resolvers for Newtonsoft JSON.Net, supporting e.g. private setters and private constructors.
C#
14
star
12

dotnet-sqldb

.NET Core Global Tool using e.g. DbUp to apply Db migrations for SQL-Server
F#
11
star
13

myinfluxdbclient

Simple, async, client for InfluxDb
C#
10
star
14

digger

C#
9
star
15

PineCone

See Structurizer instead
C#
6
star
16

mycouch.aspnet.identity

MyCouch.AspNet.Identity - an ASP.Net identity provider for CouchDb and Cloudant
C#
6
star
17

tokenserver-adventures

My Playground for IdentityServer3 samples
JavaScript
5
star
18

PreCoord

Presentation Coordinator for Impress using WebSockets
JavaScript
3
star
19

nodejsreporter

Simple sample of using Node.js and Handlebars to create custom YouTrack report.
3
star
20

SisoDb-Benchmarks

C#
3
star
21

SisoDb-Samples

Just some small samples of how SisoDb can be used in some situations.
C#
2
star
22

rill

C#
1
star
23

serilog-sinks-azureappendblob

Serilog sink that logs to append blobs in an Azure Storage Account.
C#
1
star