private async Task <JObject> CreateResponse(string command, JObject reqParams, bool fixedParam = false) { if (command.Equals("*Refresh")) { RefBook.Refresh(_context); return(await Task.Run(() => DoRefreshCommand())); } else { return(await DoCommand(command, reqParams, fixedParam)); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.ConfigureExceptionHandler(); app.UseMiddleware <BasicAuthMiddleware>(); //app.UseMiddleware<ExceptionHandler>(); using (var serviceScope = app.ApplicationServices.CreateScope()) { var services = serviceScope.ServiceProvider; MainContext dbContext = services.GetService <MainContext>(); RefBook.Refresh(dbContext); } app.UseMvc(); }
private JObject DoRefreshCommand() { RefBook.Refresh(_context); return(new JObject()); }