当前位置: 首页>>代码示例>>C#>>正文


C# DocumentClient.ReplaceDocumentAsync方法代码示例

本文整理汇总了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);
     
 }
开发者ID:mdewey,项目名称:Learning,代码行数:9,代码来源:Program.cs

示例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);
        }
开发者ID:mkhodary,项目名称:Azure_DocumentDB,代码行数:15,代码来源:Program.cs

示例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));
        }
开发者ID:mikhailshilkov,项目名称:etamanager,代码行数:17,代码来源:MessageProcessor.cs

示例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;
        }
开发者ID:sndkr,项目名称:PnP,代码行数:28,代码来源:AzureDocDbRequestManager.cs

示例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;
            }
        }
开发者ID:rnagpal,项目名称:azure-documentdb-net,代码行数:19,代码来源:Program.cs


注:本文中的Microsoft.Azure.Documents.Client.DocumentClient.ReplaceDocumentAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。