public Task UpdateGamesTable(GamesSyncResult syncResult) { if (syncResult.DefunctGameRows .Concat(syncResult.NewGameRows) .Concat(syncResult.UpdatedGameRows) .Select(r => r.PlayerID).Distinct().Count() > 1) { throw new SyncException("Can only update games for one player at a time."); } return(_gamesTable.ExecuteBatchesAsync(syncResult.DefunctGameRows.Select(TableOperation.Delete) .Concat(syncResult.NewGameRows.Select(TableOperation.Insert)) .Concat(syncResult.UpdatedGameRows.Select(TableOperation.Replace)))); }
public Task UpdatePlayersTable(PlayersSyncResult syncResult) => _playersTable.ExecuteBatchesAsync(syncResult.DefunctPlayerRows.Select(TableOperation.Delete) .Concat(syncResult.NewPlayerRows.Select(TableOperation.Insert)) .Concat(syncResult.UpdatedPlayerRows.Select(TableOperation.Replace)));