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);
        }
示例#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, 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 !");
        }
示例#3
0
 public HomeController()
 {
     _context = new SpotContext();
 }
示例#4
0
 public FacilityRepository(SpotContext context)
 {
     _context = context;
 }
示例#5
0
 public ProductsDAO()
 {
     _context = new SpotContext();
 }