abhi62003 / relax-net

Automatically exported from code.google.com/p/relax-net
GNU General Public License v3.0
0 stars 0 forks source link

Support for bulk add / delete #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Add support for bulk (batch) operations.

http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API

The following pastebin link contains my (inelegant) code (to be added to 
Session.cs) that can be used to perform bulk deletions and additions (which run 
MUCH faster).

http://pastebin.com/6rAvGBDe

It is designed to work with Cloudant URLs (that contain the username and 
password). If this code is added to Hammock, it would be good to generalize 
this. My code also uses private helper classes for serialization (which doesn't 
really fit in with the rest of the Hammock approach).

Usage example:
var c = GetConnection();
var s = c.CreateSession(DB_NAME);
s.DeleteBulk(s.ListDocuments());//delete all documents
s.SaveBulk(listOfTypedObjects);//save a list of typed objects

Original issue reported on code.google.com by kgould...@sasaki.com on 16 Mar 2012 at 3:05

GoogleCodeExporter commented 9 years ago
I've made a small modification of the proposed solution to be backwards 
compatible with the library logic (LINQ, etc).

just added required lines to set the _id as the normal save operation would do.

Original comment by ingena...@gmail.com on 16 Oct 2012 at 9:50

Attachments: