// Warning - will not work - see comment above ProblemFour method invokation in Main() public static void Main() { var mongoHandler = new MongoDbHandler(); var sqlHandler = new SqlServerHandler(); var mySqlHandler = new MySqlHandler(); var pdfHandler = new PdfHandler(); var xmlToSql = new XmlToSqlServerLoader(); var excellHandler = new ExcellHandler(); var mongoToSql = new MongoToSqlServerLoader(); var zipExtractor = new ZipExtractor(); var jsonHandler = new JsonHandler(); var sqliteHandler = new SqliteHandler(); var xmlHandler = new XmlHandler(); if (!Directory.Exists(OutputDirectory)) { Directory.CreateDirectory(OutputDirectory); } //// Mongolab.com credentials - Username: TeamXenon , Passsword: xenon123 ProblemOne(mongoHandler, mongoToSql, zipExtractor, excellHandler); ProblemTwo(pdfHandler); ProblemThree(xmlHandler); //// NOTE!!! - you need to go to CarParts.Data.MySql project and in its App.config file //// you should change the password in the connectionString tag with which you connect to your localhost instance of the MySQL Workbench server. ProblemFour(sqlHandler, mySqlHandler, jsonHandler); ProblemFive(mongoHandler, xmlToSql); ProblemSix(excellHandler, sqlHandler, sqliteHandler, mySqlHandler); }
private static void ProblemFive(MongoDbHandler mongoHandler, XmlToSqlServerLoader xmlToSql) { var xmlHandler = new XmlHandler(); var countries = xmlHandler.GetCountries(); // If these are runned before they will throw because coutries are already added to the cloud and have unique constraint to their name in sql server. // You can delete physically the data and run the method if you like. xmlToSql.LoadCountries(countries); /*try // Just in case :) { mongoHandler.WriteCollection<XmlCountry>("Countries", countries); } catch (Exception ex) { }*/ Console.WriteLine("Successfully write down countries from XML to MongoDB and SqlServer databases"); }