//takes in the name of the databse. for example KymiraDatabase29

        /**
         * params: String dbName - name of the db
         * */
        public TestDatabaseContext(String dbName)
        {
            //sets up the context for the database.
            config.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=" + dbName + ";Trusted_Connection=True;MultipleActiveResultSets=true");
            context = new KymiraAdminContext(config.Options);

            context.Database.EnsureCreated();
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, KymiraAdminContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            context.Database.EnsureCreated();
            Fixtures.fixture_disposables.Unload(context);
            Fixtures.fixture_disposables.Load(context);

            app.UseMvc();
        }
Пример #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, KymiraAdminContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }


            //Fixtures.fixture_disposables.Unload(context);
            // Fixtures.fixture_disposables.Load(context);
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Пример #4
0
 public DisposablesController(KymiraAdminContext context)
 {
     _context = context;
 }
 /**
  * this function will delete all entries  in the database.
  * */
 public static void Unload(KymiraAdminContext _context)
 {
     _context.DisposableDBSet.RemoveRange(_context.DisposableDBSet);
     _context.SaveChanges();
 }
 /**
  * This function will create a connection to a local test database and load the specific data into it.
  * */
 public static void Load(KymiraAdminContext _context)
 {
     _context.DisposableDBSet.AddRange(obList);
     _context.SaveChanges();
 }
 public SiteController(KymiraAdminContext context)
 {
     _context = context;
 }