} // end function protected override void Down(MigrationBuilder migrationBuilder) { try { Console.WriteLine("Deleting item and spell data. This might take a few minutes... be patient and don't exit early!"); } catch { } var allItemsAndSpells = getAllItemsAndSpells(); using (var context = new TunnelQuestContext()) { using (var transaction = context.Database.BeginTransaction()) { try { // delete items first var itemsToDelete = new List <Item>(); foreach (var fullItem in allItemsAndSpells.Items) { itemsToDelete.Add(new Item() { ItemName = fullItem.ItemName }); } context.RemoveRange(itemsToDelete); context.SaveChanges(); // delete spells second var spellsToDelete = new List <Spell>(); foreach (var fullSpell in allItemsAndSpells.Spells) { spellsToDelete.Add(new Spell() { SpellName = fullSpell.SpellName }); } context.RemoveRange(spellsToDelete); context.SaveChanges(); transaction.Commit(); } catch { transaction.Rollback(); throw; } } } try { Console.WriteLine("Finished deleting item and spell data."); } catch { } }
private void deleteAliases(TunnelQuestContext context) { context.RemoveRange(getAliases()); }
private void deleteDeities(TunnelQuestContext context) { context.RemoveRange(getDeities()); }
private void deleteWeaponSkills(TunnelQuestContext context) { context.RemoveRange(getWeaponSkills()); }
private void deleteEffectTypes(TunnelQuestContext context) { context.RemoveRange(getEffectTypes()); }
private void deleteSlots(TunnelQuestContext context) { context.RemoveRange(getSlots()); }
private void deleteClasses(TunnelQuestContext context) { context.RemoveRange(getClasses()); }
private void deleteAuthTokenStatuses(TunnelQuestContext context) { context.RemoveRange(getAuthTokenStatuses()); }