/// <summary> /// Translate the json document to a <see cref = "RavenJObject" /> /// </summary> /// <returns></returns> public RavenJObject ToJson() { var doc = (RavenJObject)DataAsJson.CloneToken(); var metadata = (RavenJObject)Metadata.CloneToken(); if (LastModified != null) { metadata[Constants.LastModified] = LastModified.Value; } if (Etag != null) { metadata["@etag"] = Etag.Value.ToString(); } if (NonAuthoritativeInformation != null) { metadata["Non-Authoritative-Information"] = NonAuthoritativeInformation.Value; } doc["@metadata"] = metadata; return(doc); }
/// <summary> /// Translate the json document to a <see cref = "JObject" /> /// </summary> /// <returns></returns> public JObject ToJson() { var docSnapshot = (JObject)DataAsJson.CloneToken(); var metadataSnapshot = (JObject)Metadata.CloneToken(); if (LastModified != null) { metadataSnapshot[Constants.LastModified] = LastModified.Value; } if (Etag != null) { metadataSnapshot["@etag"] = Etag.Value.ToString(); } if (NonAuthoritativeInformation != null) { metadataSnapshot["Non-Authoritative-Information"] = NonAuthoritativeInformation.Value; } //if (metadata.ContainsKey("@id") == false) // metadata["@id"] = Key; docSnapshot["@metadata"] = metadataSnapshot; return(docSnapshot); }