/// <summary> /// Get the correct Select changes command /// Can be either /// - SelectInitializedChanges : All changes for first sync /// - SelectChanges : All changes filtered by timestamp /// - SelectInitializedChangesWithFilters : All changes for first sync with filters /// - SelectChangesWithFilters : All changes filtered by timestamp with filters /// </summary> private async Task <DbCommand> GetSelectChangesCommandAsync(SyncContext context, DbSyncAdapter syncAdapter, SyncTable syncTable, bool isNew) { DbCommand selectIncrementalChangesCommand; DbCommandType dbCommandType; SyncFilter tableFilter = null; // Check if we have parameters specified // Sqlite does not have any filter, since he can't be server side if (this.CanBeServerProvider) { tableFilter = syncTable.GetFilter(); } var hasFilters = tableFilter != null; // Determing the correct DbCommandType if (isNew && hasFilters) { dbCommandType = DbCommandType.SelectInitializedChangesWithFilters; } else if (isNew && !hasFilters) { dbCommandType = DbCommandType.SelectInitializedChanges; } else if (!isNew && hasFilters) { dbCommandType = DbCommandType.SelectChangesWithFilters; } else { dbCommandType = DbCommandType.SelectChanges; } // Get correct Select incremental changes command selectIncrementalChangesCommand = syncAdapter.GetCommand(dbCommandType, tableFilter); if (selectIncrementalChangesCommand == null) { throw new MissingCommandException(dbCommandType.ToString()); } // Add common parameters await syncAdapter.SetCommandParametersAsync(dbCommandType, selectIncrementalChangesCommand, tableFilter); return(selectIncrementalChangesCommand); }