public void SetUp() { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var connectionString = config["connectionStrings:DWAPICentralConnection"]; var options = new DbContextOptionsBuilder <SpotContext>() .UseSqlServer(connectionString) .Options; _context = new SpotContext(options); _facilityRepository = new FacilityRepository(_context); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, SpotContext spotContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } app.Use(async(context, next) => { await next(); if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value) && !context.Request.Path.Value.StartsWith("/api/")) { context.Request.Path = "/index.html"; await next(); } }); app.UseMvcWithDefaultRoute(); app.UseDefaultFiles(); app.UseStaticFiles(); Log.Debug("Database initializing..."); spotContext.CreateViews(); Log.Debug("Database initialized !"); Log.Debug(@"---------------------------------------------------------------------------------------------------"); Log.Debug (@" _____ _____ ____ _______ / ____| __ \ / __ \__ __| | (___ | |__) | | | | | | \___ \| ___/| | | | | | ____) | | | |__| | | | |_____/|_| \____/ |_| "); Log.Debug(@"---------------------------------------------------------------------------------------------------"); Log.Debug("Spot started !"); }
public HomeController() { _context = new SpotContext(); }
public FacilityRepository(SpotContext context) { _context = context; }
public ProductsDAO() { _context = new SpotContext(); }