Beispiel #1
0
        static void Main(string[] args)
        {
            // Sample Code to get a connection string from the
            // App.Config file
            // Use this so that you don't need to copy your connection string all over your code!
            //string connectionString = ConfigurationManager.ConnectionStrings["CapstoneDatabase"].ConnectionString;
            string           connectionString = @"Data Source =.\sqlexpress;Initial Catalog = NationalParks; Integrated Security = True";
            NationalParksCLI cli = new NationalParksCLI();

            cli.RunCLI(connectionString);

            // Main should only have a few lines of code
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Get the connection string from the appsettings.json file
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(Directory.GetCurrentDirectory())
                                            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("Project");

            ICampgroundSqlDAO  campgroundDAO  = new CampgroundSqlDAO(connectionString);
            IParksSqlDAO       parkDAO        = new ParkSqlDAO(connectionString);
            IReservationSqlDAO reservationDAO = new ReservationSqlDAO(connectionString);
            ISiteSqlDAO        siteDAO        = new SiteSqlDAO(connectionString);


            NationalParksCLI nationalPark = new NationalParksCLI(parkDAO, campgroundDAO, reservationDAO, siteDAO);

            nationalPark.Run();
        }