public void Migrate() { var realms = SourceDbContext.Realms.ToList(); foreach (var realm in realms) { var newEntity = new GameRealm() { Id = _gameRealmKeyMapper.MapKey(realm.Id), Name = realm.Name, GameId = realm.GameId }; TargetDbContext.GameRealms.Add(newEntity); } TargetDbContext.SaveChanges(); }
public void Migrate() { var guilds = SourceDbContext.Guilds.ToList(); foreach (var guild in guilds) { var newGuild = new GameGuild() { Id = _gameGuildKeyMapper.MapKey(guild.Id), Name = guild.Name, GameId = guild.GameId, GameRealmId = _gameRealmKeyMapper.MapKey(guild.RealmId) }; TargetDbContext.GameGuilds.Add(newGuild); } TargetDbContext.SaveChanges(); }
public void Migrate() { var guildCharacters = SourceDbContext.GuildCharacters.ToList(); foreach (var guildCharacter in guildCharacters) { var newEntity = new GameCharacter() { Id = _gameCharacterKeyMapper.MapKey(guildCharacter.Id), Name = guildCharacter.Name, FromTime = guildCharacter.FromTime, EndTime = guildCharacter.EndTime, GameRealmId = _gameRealmKeyMapper.MapKey(guildCharacter.RealmId) }; TargetDbContext.GameCharacters.Add(newEntity); } TargetDbContext.SaveChanges(); }