예제 #1
0
        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))));
        }
예제 #2
0
 public Task UpdatePlayersTable(PlayersSyncResult syncResult)
 => _playersTable.ExecuteBatchesAsync(syncResult.DefunctPlayerRows.Select(TableOperation.Delete)
                                      .Concat(syncResult.NewPlayerRows.Select(TableOperation.Insert))
                                      .Concat(syncResult.UpdatedPlayerRows.Select(TableOperation.Replace)));