static void Main(string[] args) { // This code reads the connection string from appsettings.json // Add the connection string to appsettings.json and un-comment the following lines to read the configuration IConfigurationBuilder builder = new ConfigurationBuilder(); builder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); IConfigurationRoot configuration = builder.Build(); string connectionString = configuration.GetConnectionString("World"); // TEMPORARY: DB EXAMPLE (vanilla, no DAO) //ReadCities(); //return; ICountryDAO countryDAO = new CountrySqlDAO(connectionString); ICityDAO cityDAO = new CitySqlDAO(connectionString); // TODO 14a: Create a Model for CountryLanguage // TODO 14b: Create a CountryLanguageSqlDAO class (GetLanguages(string countryCode)) // TODO 14c: Create an ICountryLanguageDAO interface ICountryLanguageDAO countryLanguageDAO = new CountryLanguageSqlDAO(connectionString); // Create a WorldDBMenu, passing in the country dao, and Run it WorldDBMenu menu = new WorldDBMenu(countryDAO, cityDAO, countryLanguageDAO); menu.Show(); // Say goodbye to the user... Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Goodbye..."); Thread.Sleep(1500); }
static void Main(string[] args) { // This code reads the connection string from appsettings.json // TODO 03: Add the connection string to appsettings.json and un-comment the following lines to read the configuration IConfigurationBuilder builder = new ConfigurationBuilder(); builder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); IConfigurationRoot configuration = builder.Build(); string connectionString = configuration.GetConnectionString("World"); // TEMPORARY: DB EXAMPLE (vanilla, no DAO) //ReadCities(); //return; /* CREATED JUST TO TEST MENU * CountrySqlDAO dao = new CountrySqlDAO(connectionString); * List<Country> list = dao.GetCountries("Asia"); * * Country country = dao.GetCountry("ZZZ"); * * country = dao.GetCountry("USA"); */ // TODO 04a: Create a Model for Country to go with the City model we already have // TODO 04b: Create a CountrySqlDAO class (GetCountries, GetCountries(continent), GetCountry(code)) // TODO 04c: Create an ICountryDAO interface // TODO 10: Create a CitySqlDAO class (GetCitiesByCountryCode) // TODO 10a: Create an ICityDAO interface // TODO 14a: Create a Model for CountryLanguage // TODO 14b: Create a CountryLanguageSqlDAO class (GetLanguages(string countryCode)) // TODO 14c: Create an ICountryLanguageDAO interface ICountryDAO countryDAO = new CountrySqlDAO(connectionString); ICityDAO cityDAO = new CitySqlDAO(connectionString); // TODO 05b: Create a WorldDBMenu, passing in the country dao, and Run it WorldDBMenu menu = new WorldDBMenu(countryDAO, cityDAO); menu.Show(); // Say goodbye to the user... Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Goodbye..."); Thread.Sleep(1500); }