private void SeedMap() { if (_context == null) throw new ArgumentNullException("context"); // Universe var akabow = new Location { Name = ModelConstants.Location.Universe_Akabow, Type = ModelEnums.LocationType.Universe }; akabow.SetTag(); _context.Locations.AddOrUpdate(x => x.Name, akabow); // World var nuh = new Location { Name = ModelConstants.Location.World_Nuh, Type = ModelEnums.LocationType.World, ParentLocation = akabow }; nuh.SetTag(); _context.Locations.AddOrUpdate(x => x.Name, nuh); // Region var regionMataViva = new Location { Name = ModelConstants.Location.Region_Mata_Viva, Type = ModelEnums.LocationType.Region, ParentLocation = nuh }; var regionMontanhaNeves = new Location { Name = ModelConstants.Location.Region_Montanha_Das_Neves, Type = ModelEnums.LocationType.Region, ParentLocation = nuh }; var regionVerdeColorido = new Location { Name = ModelConstants.Location.Region_Verde_Colorido, Type = ModelEnums.LocationType.Region, ParentLocation = nuh }; regionMataViva.SetTag(); regionMontanhaNeves.SetTag(); regionVerdeColorido.SetTag(); _context.Locations.AddOrUpdate(x => x.Name, regionMataViva, regionMontanhaNeves, regionVerdeColorido); // City _cityLuranzi = new Location { Name = ModelConstants.Location.City_Luranzi, Type = ModelEnums.LocationType.City, ParentLocation = regionMataViva }; _cityDavus = new Location { Name = ModelConstants.Location.City_Davus, Type = ModelEnums.LocationType.City, ParentLocation = regionMontanhaNeves }; _cityNohi = new Location { Name = ModelConstants.Location.City_Nohi, Type = ModelEnums.LocationType.City, ParentLocation = regionVerdeColorido }; _cityLuranzi.SetTag(); _cityDavus.SetTag(); _cityNohi.SetTag(); _context.Locations.AddOrUpdate(x => x.Name, _cityLuranzi, _cityDavus, _cityNohi); // Dungeon _dungeonCalaboucos = new Location { Name = ModelConstants.Location.Dungeon_Calaboucos, Type = ModelEnums.LocationType.Dungeon, ParentLocation = regionMataViva }; _dungeonTorresAbandonadas = new Location { Name = ModelConstants.Location.Dungeon_Torres_Abandonadas, Type = ModelEnums.LocationType.Dungeon, ParentLocation = regionMontanhaNeves }; _dungeonPraiaDeserta = new Location { Name = ModelConstants.Location.Dungeon_Praia_Deserta, Type = ModelEnums.LocationType.Dungeon, ParentLocation = regionVerdeColorido }; _dungeonCalaboucos.SetTag(); _dungeonTorresAbandonadas.SetTag(); _dungeonPraiaDeserta.SetTag(); _context.Locations.AddOrUpdate(x => x.Name, _dungeonCalaboucos, _dungeonTorresAbandonadas, _dungeonPraiaDeserta); _context.SaveChanges(); }