Example #1
0
        public void Migrate()
        {
            var gameRaces = SourceDbContext.GameRaces.ToList();

            foreach (var gameRace in gameRaces)
            {
                var newEntity = new GameRace()
                {
                    Id            = _gameRaceKeyMapper.MapKey(gameRace.Id),
                    Name          = gameRace.Name,
                    GameId        = gameRace.GameId,
                    GameFactionId = _gameFactionKeyMapper.MapKey(gameRace.FactionId)
                };

                TargetDbContext.GameRaces.Add(newEntity);
            }

            TargetDbContext.SaveChanges();
        }
        public void Migrate()
        {
            var guildCharacterVersions = SourceDbContext.GuildCharacterVersions.ToList();

            foreach (var guildCharacterVersion in guildCharacterVersions)
            {
                var newEntity = new GameCharacterVersion()
                {
                    Id              = _gameCharacterVersionKeyMapper.MapKey(guildCharacterVersion.Id),
                    FromTime        = guildCharacterVersion.FromTime,
                    EndTime         = guildCharacterVersion.EndTime,
                    Level           = guildCharacterVersion.Level,
                    GameCharacterId = _gameCharacterKeyMapper.MapKey(guildCharacterVersion.CharacterId),
                    GameRaceId      = _gameRaceKeyMapper.MapKey(guildCharacterVersion.GameRaceId),
                    GameClassId     = _gameClassKeyMapper.MapKey(guildCharacterVersion.GameClassId)
                };

                TargetDbContext.GameCharacterVersions.Add(newEntity);
            }

            TargetDbContext.SaveChanges();
        }