sdk/dotnet/src/Microsoft.Datasync.Client/Offline/Queue/OperationsQueue.cs
/// <summary>
/// Initializes the operations queue using data from the persistent store.
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe.</param>
/// <returns>A task that completes when the operations queue is initialized.</returns>
Initializes the operations queue using data from the persistent store.
Initializes the operations queue using data from the persistent store .
public async Task InitializeAsync(CancellationToken cancellationToken = default)
        {
            using (await AcquireLockAsync(cancellationToken).ConfigureAwait(false))
            {
                if (IsInitialized)
                {
                    return;
                }
                var query = new QueryDescription(SystemTables.OperationsQueue) { IncludeTotalCount = true, Top = 1 };
                query.Ordering.Add(new OrderByNode(new MemberAccessNode(null, "sequence"), OrderByDirection.Descending));
                Page<JObject> page = await OfflineStore.GetPageAsync(query, cancellationToken).ConfigureAwait(false);
                pendingOperations = page.Count ?? 0;
                sequenceId = page.Items?.Select(v => v.Value<long>("sequence")).FirstOrDefault() ?? 0;
                IsInitialized = true;
            }
        }
public async Task InitializeAsync ( CancellationToken cancellationToken = default ) { using ( await AcquireLockAsync ( cancellationToken ) . ConfigureAwait ( false ) ) { if ( IsInitialized ) { return ; } var query = new QueryDescription ( SystemTables . OperationsQueue ) { IncludeTotalCount = true , Top = 1 } ; query . Ordering . Add ( new OrderByNode ( new MemberAccessNode ( null , " " ) , OrderByDirection . Descending ) ) ; Page < JObject > page = await OfflineStore . GetPageAsync ( query , cancellationToken ) . ConfigureAwait ( false ) ; pendingOperations = page . Count ?? 0 ; sequenceId = page . Items ? . Select ( v => v . Value < long > ( " " ) ) . FirstOrDefault ( ) ?? 0 ; IsInitialized = true ; } }
Initializes the operations queue using data from the persistent store.
Initializes the operations queue using data from the persistent store .
A task that completes when the operations queue is initialized.
A task that completes when the operations queue is initialized .
cancellationToken
CancellationToken
A  to observe.
A to observe .