C# Class Divan.CouchDocument

This is a base class that domain objects can inherit in order to get Id and Rev instance variables. You can also implement ICouchDocument yourself if you are not free to pick this class as your base. Some static methods to read and write CouchDB documents are also kept here. This class can also be used if you only need to retrieve id and revision from CouchDB. See sample subclasses to understand how to use this class.
Inheritance: ICouchDocument, IReconcilingDocument
Mostrar archivo Open project: kolosy/Divan Class Usage Examples

Public Methods

Method Description
CouchDocument ( ) : System
CouchDocument ( JToken>.IDictionary doc ) : System
CouchDocument ( string id ) : System
CouchDocument ( string id, string rev ) : System
GetDatabaseCopy ( ICouchDatabase db ) : IReconcilingDocument
ReadIdAndRev ( ICouchDocument doc, Newtonsoft.Json.Linq.JObject obj ) : void
ReadIdAndRev ( ICouchDocument doc, JsonReader reader ) : void
ReadJson ( Newtonsoft.Json.Linq.JObject obj ) : void
Reconcile ( ICouchDocument databaseCopy ) : void

Called by the runtime when a conflict is detected during save. The supplied parameter is the database copy of the document being saved.

SaveCommited ( ) : void
WriteIdAndRev ( ICouchDocument doc, JsonWriter writer ) : void
WriteJson ( ICanJson doc ) : string
WriteJson ( JsonWriter writer ) : void
WriteJsonObject ( JsonWriter writer ) : void

Protected Methods

Method Description
AutoClone ( ) : CouchDocument
AutoReconcile ( ICouchDocument databaseCopy ) : void

Automatically reconcile the database copy with the target instance. This method uses reflection to perform the reconcilliation, and as such won't perform as well as other version, but is available for low-occurance scenarios

Clone ( ) : CouchDocument

Private Methods

Method Description
EqualFields ( object v1, object v2 ) : bool

Method Details

AutoClone() protected method

protected AutoClone ( ) : CouchDocument
return CouchDocument

AutoReconcile() protected method

Automatically reconcile the database copy with the target instance. This method uses reflection to perform the reconcilliation, and as such won't perform as well as other version, but is available for low-occurance scenarios
protected AutoReconcile ( ICouchDocument databaseCopy ) : void
databaseCopy ICouchDocument
return void

Clone() protected method

protected Clone ( ) : CouchDocument
return CouchDocument

CouchDocument() public method

public CouchDocument ( ) : System
return System

CouchDocument() public method

public CouchDocument ( JToken>.IDictionary doc ) : System
doc JToken>.IDictionary
return System

CouchDocument() public method

public CouchDocument ( string id ) : System
id string
return System

CouchDocument() public method

public CouchDocument ( string id, string rev ) : System
id string
rev string
return System

GetDatabaseCopy() public method

public GetDatabaseCopy ( ICouchDatabase db ) : IReconcilingDocument
db ICouchDatabase
return IReconcilingDocument

ReadIdAndRev() public static method

public static ReadIdAndRev ( ICouchDocument doc, Newtonsoft.Json.Linq.JObject obj ) : void
doc ICouchDocument
obj Newtonsoft.Json.Linq.JObject
return void

ReadIdAndRev() public static method

public static ReadIdAndRev ( ICouchDocument doc, JsonReader reader ) : void
doc ICouchDocument
reader Newtonsoft.Json.JsonReader
return void

ReadJson() public method

public ReadJson ( Newtonsoft.Json.Linq.JObject obj ) : void
obj Newtonsoft.Json.Linq.JObject
return void

Reconcile() public method

Called by the runtime when a conflict is detected during save. The supplied parameter is the database copy of the document being saved.
public Reconcile ( ICouchDocument databaseCopy ) : void
databaseCopy ICouchDocument
return void

SaveCommited() public method

public SaveCommited ( ) : void
return void

WriteIdAndRev() public static method

public static WriteIdAndRev ( ICouchDocument doc, JsonWriter writer ) : void
doc ICouchDocument
writer Newtonsoft.Json.JsonWriter
return void

WriteJson() public static method

public static WriteJson ( ICanJson doc ) : string
doc ICanJson
return string

WriteJson() public method

public WriteJson ( JsonWriter writer ) : void
writer Newtonsoft.Json.JsonWriter
return void

WriteJsonObject() public method

public WriteJsonObject ( JsonWriter writer ) : void
writer Newtonsoft.Json.JsonWriter
return void