当前位置: 首页>>代码示例>>C#>>正文


C# DataAccess.Refresh方法代码示例

本文整理汇总了C#中DataAccess.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.Refresh方法的具体用法?C# DataAccess.Refresh怎么用?C# DataAccess.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataAccess的用法示例。


在下文中一共展示了DataAccess.Refresh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveGame

        private int SaveGame(DataAccess.CSSDataContext db, DataAccess.CSSStatsDataContext statsDB, DataAccess.GameServer gameServer, Data.GameDataset.GameRow gameRow)
        {
            DataAccess.Game game = new Allegiance.CommunitySecuritySystem.DataAccess.Game()
            {
                GameDefections = gameRow.AllowDefections,
                GameDevelopments = gameRow.AllowDevelopments,
                GameShipyards = gameRow.AllowShipyards,
                GameConquest = gameRow.Conquest,
                GameCore = TrimString(gameRow.CoreFile, 50),
                GameDeathMatch = gameRow.DeathMatch,
                GameDeathmatchGoal = gameRow.DeathmatchGoal,
                GameEndTime = gameRow.EndTime,
                GameFriendlyFire = gameRow.FriendlyFire,
                GameName = TrimString(gameRow.GameName, 254),
                GameInvulStations = gameRow.InvulnerableStations,
                GameMap = TrimString(gameRow.MapName, 49),
                GameMaxImbalance = gameRow.MaxImbalance,
                GameResources = gameRow.Resources,
                GameRevealMap = gameRow.RevealMap,
                GameSquadGame = gameRow.SquadGame,
                GameStartingMoney = gameRow.StartingMoney,
                GameStartTime = gameRow.StartTime,
                GameStatsCount = gameRow.StatsCount,
                GameTotalMoney = gameRow.TotalMoney,
                GameID = gameRow.GameID,
                GameServer = gameServer.GameServerID
            };

            statsDB.Games.InsertOnSubmit(game);

            try
            {
                statsDB.SubmitChanges();
            }
            catch (Exception ex)
            {
                string dbLengthErrors = Utilities.LinqErrorDetector.AnalyzeDBChanges(statsDB);
                throw new Exception("CSSStats[games]: DB Error, Linq Length Analysis: " + dbLengthErrors + "\r\n", ex);
            }

            SaveGameEvents(db, statsDB, gameRow, game.GameIdentID);

            SaveTeams(db, statsDB, gameRow, game.GameIdentID);

            SaveChatLog(db, statsDB, gameRow, game.GameIdentID);

            try
            {
                statsDB.SubmitChanges();
            }
            catch (Exception ex)
            {
                string dbLengthErrors = Utilities.LinqErrorDetector.AnalyzeDBChanges(statsDB);
                throw new Exception("CSSStats[game data]: DB Error, Linq Length Analysis: " + dbLengthErrors + "\r\n", ex);
            }

            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                string dbLengthErrors = Utilities.LinqErrorDetector.AnalyzeDBChanges(db);
                throw new Exception("CSS DB Error, Linq Length Analysis: " + dbLengthErrors + "\r\n", ex);
            }

            statsDB.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, game);

            UpdateLeaderboard(game.GameIdentID);

            UpdateFactionStats(game.GameIdentID);

            UpdateMetrics(game.GameIdentID);

            statsDB.SubmitChanges();
            db.SubmitChanges();

            return game.GameIdentID;
        }
开发者ID:LordBlacksun,项目名称:Allegiance-Community-Security-System,代码行数:79,代码来源:Tag.cs


注:本文中的DataAccess.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。