public static T ReadDocument <T>(ICollectionContext context, String documentId , object partitionKeyValue = null ) where T : Document { Uri docUri = context.DocumentUri(documentId); var response = context.ProcessResourceResponse( String.Format("Read Document by id ({0}), partition ({1})", documentId, partitionKeyValue), context.Client.ReadDocumentAsync( docUri , new RequestOptions() { PartitionKey = new PartitionKey(partitionKeyValue) } ) .Result); return((dynamic)response.Resource); }
public static void ReplaceDocument <T>(ICollectionContext context, T doc) where T : Resource { var response = context.Client.ReplaceDocumentAsync(context.DocumentUri(doc.Id), doc).Result; Debug.WriteLine(String.Format("Replace response request charge: {0}", response.RequestCharge)); }