private static void ImportTradersFromXml(string path) { var xmlImporter = new XmlDataImporter(); var dbContext = new ChemicalsDbContext(); var traders = xmlImporter.LoadTraders(path); foreach (var trader in traders) { dbContext.Traders.Add(trader); } dbContext.SaveChanges(); dbContext.Dispose(); ExportXmlTradersToMongo(traders); }
private static void ImportManufacturersFromXml(string path) { var xmlImporter = new XmlDataImporter(); var dbContext = new ChemicalsDbContext(); var manufacturers = xmlImporter.LoadManufecturers(path); foreach (var manufacturer in manufacturers) { dbContext.Manufacturers.Add(manufacturer); } dbContext.SaveChanges(); dbContext.Dispose(); ExportXmlManufacturersToMongo(manufacturers); Console.WriteLine("The data was successfully imported to SQL Server and to MongoDB."); }