Skip to content
Browse files

Changed Document's Rev and Id properties behaviour. They now use JObj…

…ect's

"_rev" and "_id" fields respectively. It helps to avoid getting different
values from properties and using indexer.
  • Loading branch information...
1 parent d87fda3 commit 0f84ea897405f7c3a9e547acbb3ad5106ba52545 @deadok22 deadok22 committed Jan 28, 2012
Showing with 17 additions and 4 deletions.
  1. +17 −4 LoveSeat/Document.cs
View
21 LoveSeat/Document.cs
@@ -73,11 +73,24 @@ public class BulkDocumentResponse
public class Document : JObject, IBaseObject
{
- [JsonProperty("_id")]
- public string Id { get; set; }
+ [JsonIgnore]
+ public string Id
+ {
+ get {
+ JToken id;
+ return this.TryGetValue("_id", out id) ? id.ToString() : null;
+ }
+ set { this["_id"] = value; }
+ }
- [JsonProperty("_rev")]
- public string Rev { get; set; }
+ [JsonIgnore]
+ public string Rev {
+ get {
+ JToken rev;
+ return this.TryGetValue("_rev", out rev) ? rev.ToString() : null;
+ }
+ set { this["_rev"] = value; }
+ }
public string Type { get; private set; }

0 comments on commit 0f84ea8

Please sign in to comment.
Something went wrong with that request. Please try again.