本文整理汇总了C#中Microsoft.Azure.Documents.Client.DocumentClient.ReplaceDocumentAsync方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentClient.ReplaceDocumentAsync方法的具体用法?C# DocumentClient.ReplaceDocumentAsync怎么用?C# DocumentClient.ReplaceDocumentAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Azure.Documents.Client.DocumentClient
的用法示例。
在下文中一共展示了DocumentClient.ReplaceDocumentAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GoOnVacation
public async static Task GoOnVacation(DocumentClient client, DocumentCollection collection, string jeffersons, bool left)
{
var family = GetFamily(client, collection, jeffersons);
dynamic doc = GetDocumentById(client, collection,family.id);
Family f = doc;
f.IsHome = false;
var task = await client.ReplaceDocumentAsync(doc.SelfLink, f);
}
示例2: UpdateCourse
private static async Task UpdateCourse(Guid guid, DocumentCollection documentCollection)
{
DocumentClient documentClient = new DocumentClient(new Uri("https://schooltest.documents.azure.com:443/"),
"Of414DnEibhmqeSTB0pKShdQtR6dxxfXP8uT93pggxoumKthJGzuECCUJZ27Pqf846VUkFfOrraMTQ74PZaywA==");
Course course = documentClient.CreateDocumentQuery<Course>(documentCollection.DocumentsLink,
new SqlQuerySpec(string.Format("SELECT * FROM c WHERE c.CourseId = '{0}'", guid))).AsEnumerable().FirstOrDefault();
if (course == null)
return;
course.Name = "THIS IS THE PERFECT NAME...2..";
await documentClient.ReplaceDocumentAsync(course);
}
示例3: Start
public void Start()
{
QueueUtility.Listen<EventController.Position>("PositionQueue", async position =>
{
var client = new DocumentClient(new Uri("https://etamanager.documents.azure.com:443/"), "HIgfJLkqRsemDoAv62MSn0/UFK2dC9RxtAopuV3rAa7f1tCqou/A2xbh1ShLDkKDaWOPLEsZ0sl7dGzjrEz36A==");
var trip = client.CreateDocumentQuery<TripDocument>("dbs/-gIgAA==/colls/-gIgALa0OwA=").Where(t => t.Code == position.TripCode).AsEnumerable().FirstOrDefault();
if (trip != null)
{
trip.ExpectedArrival = position.DT;
await client.ReplaceDocumentAsync(trip.SelfLink, trip);
}
var update = new EventController.ETAUpdate { code = position.TripCode, expectedArrival = position.DT };
QueueUtility.Send("ETAUpdateQueue", update);
});
QueueUtility.Listen<EventController.ETAUpdate>("ETAUpdateQueue", update => this.tripsHub.Clients.All.addNewMessageToPage(update));
}
示例4: UpdateSiteRequestStatusByUrl
/// <summary>
/// Internal Member to Update Request and Status properties Azure DocumentDB by url
/// </summary>
/// <param name="client"></param>
/// <param name="selfLink"></param>
/// <param name="request"></param>
/// <param name="status"></param>
/// <param name="message"></param>
/// <returns></returns>
private Document UpdateSiteRequestStatusByUrl(DocumentClient client, string selfLink, SiteInformation request, SiteRequestStatus status, string message)
{
dynamic _requestDocument = client.CreateDocumentQuery<Document>(selfLink).Where(d => d.Id == request.Id).AsEnumerable().FirstOrDefault();
Document _d = _requestDocument; //Cast to Document to get the Selflink property
Document _dReturnResult = null;
SiteInformation _requestToUpdate = _requestDocument;
if(!string.IsNullOrEmpty(message))
{
_requestToUpdate.RequestStatusMessage = message;
}
_requestToUpdate.EnumStatus = status;
var savedRequestTask = Task.FromResult(client.ReplaceDocumentAsync(_d.SelfLink, _requestToUpdate));
if (!savedRequestTask.Result.IsFaulted)
{
_dReturnResult = savedRequestTask.Result.Result;
}
return _dReturnResult;
}
示例5: ResetActiveTransactionsDocIfNotExists
private static async Task ResetActiveTransactionsDocIfNotExists()
{
var client = new DocumentClient(new Uri(Endpoint), AuthKey);
Uri collectionLink = UriFactory.CreateDocumentUri(DbName, CollectionName, activeTransactionsDocId.ToString());
ActiveTransactions activeTransactionsDoc = new ActiveTransactions
{
Id = activeTransactionsDocId,
Transactions = new List<string>()
};
try {
await client.ReplaceDocumentAsync(collectionLink, activeTransactionsDoc);
}
catch (DocumentClientException de)
{
throw;
}
}