public JObject ToJson()
{
if (Projection != null)
return Projection;
var doc = new JObject(DataAsJson);//clone the document
var metadata = new JObject(Metadata);// clone the metadata
var etagProp = metadata.Property("@etag");
if (etagProp == null)
{
etagProp = new JProperty("@etag");
metadata.Add(etagProp);
}
etagProp.Value = new JValue(Etag.ToString());
doc.Add("@metadata", metadata);
Metadata["Non-Authoritive-Information"] = JToken.FromObject(NonAuthoritiveInformation);
return doc;
}
}