@@ -265,19 +265,19 @@ private async Task RunCrudAndQuerySample(Database database, IPartitionResolver p
265
265
UserProfile johnProfile = ( UserProfile ) ( dynamic ) latestJohnDocument ;
266
266
johnProfile . Status = UserStatus . Busy ;
267
267
268
- await this . client . ReplaceDocumentAsync ( latestJohnDocument ) ;
268
+ await this . client . ReplaceDocumentAsync ( latestJohnDocument . SelfLink , johnProfile ) ;
269
269
270
270
// Query for John's document by ID. We can use the PartitionResolver to restrict the query to just the partition containing @John
271
271
// Again the query uses the database self link, and relies on the hash resolver to route the appropriate collection.
272
272
var query = this . client . CreateDocumentQuery < UserProfile > ( database . SelfLink , null , partitionResolver . GetPartitionKey ( johnProfile ) )
273
273
. Where ( u => u . UserName == "@John" ) ;
274
274
johnProfile = query . AsEnumerable ( ) . FirstOrDefault ( ) ;
275
275
276
- // Query for all Available users. Here since there is no partition key, the query is serially executed across each partition/collection.
277
- query = this . client . CreateDocumentQuery < UserProfile > ( database . SelfLink ) . Where ( u => u . Status == UserStatus . Available ) ;
278
- foreach ( UserProfile activeUser in query )
276
+ // Query for all Busy users. Here since there is no partition key, the query is serially executed across each partition/collection.
277
+ query = this . client . CreateDocumentQuery < UserProfile > ( database . SelfLink ) . Where ( u => u . Status == UserStatus . Busy ) ;
278
+ foreach ( UserProfile busyUser in query )
279
279
{
280
- Console . WriteLine ( activeUser ) ;
280
+ Console . WriteLine ( busyUser ) ;
281
281
}
282
282
283
283
// Find the collections where a document exists in. It's uncommon to do this, but can be useful if for example to execute a
@@ -295,7 +295,6 @@ private async Task RunCrudAndQuerySample(Database database, IPartitionResolver p
295
295
/// <summary>
296
296
/// Illustrate how to load and save the serializer state. Uses HashPartitionResolver as example.
297
297
/// </summary>
298
- /// <param name="hashResolver">The HashResolver instance.</param>
299
298
private void RunSerializeDeserializeSample ( HashPartitionResolver hashResolver )
300
299
{
301
300
// Store the partition resolver's configuration as JSON.
@@ -315,7 +314,7 @@ private void RunSerializeDeserializeSample(HashPartitionResolver hashResolver)
315
314
/// Show how to repartition a hash resolver by adding/removing collections.
316
315
/// </summary>
317
316
/// <param name="database">The database to run the samples on.</param>
318
- /// <returns>The created HashPartitionResolver .</returns>
317
+ /// <returns>The Task for the asynchronous execution .</returns>
319
318
private async Task RepartitionDataSample ( Database database )
320
319
{
321
320
var manager = new DocumentClientHashPartitioningManager ( u => ( ( UserProfile ) ( dynamic ) u ) . UserId , this . client , database , 3 ) ;
0 commit comments