public void Configure(IApplicationBuilder app, IHostingEnvironment env, IAutostartActorInitializer autostartActorInitializer, DbContext dbContext, IPasswordCryptoService passwordCryptoService) { app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); app.UseMiddleware <JwtTokenMiddleware>(); app.UseAuthentication(); app.UseMvc(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Bellwether api v1"); }); (dbContext as BellwetherContext).EnsureSeedData(passwordCryptoService); autostartActorInitializer.FindAndStartActors(); }
public void RebuildScopeWithRegistrations(Action <ContainerBuilder> registrations) { _autostartActorInitializer?.StopAllAutostartedActors(); _autostartActorInitializer = null; var builder = new ContainerBuilder(); builder.RegisterModule <BellwetherTestsModule>(); builder.RegisterInstance(_configuration).AsImplementedInterfaces(); registrations(builder); Scope = builder.Build(); new AutoFacDependencyResolver(Scope, Scope.Resolve <IActorSystemManager>().ActorSystem); _autostartActorInitializer = Scope.Resolve <IAutostartActorInitializer>(); _autostartActorInitializer.FindAndStartActors(typeof(BellwetherApplicationModule).Assembly, typeof(BellwetherPresentationModule).Assembly); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IServiceProvider serviceProvider, IApplicationBuilder app, IHostingEnvironment env, IAutostartActorInitializer autostartActorInitializer, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(); loggerFactory.AddDebug(); using (var serviceScope = serviceProvider.GetService<IServiceScopeFactory>().CreateScope()) { var context = serviceScope.ServiceProvider.GetRequiredService<HomeExpensesDbContext>(); context.Database.Migrate(); } autostartActorInitializer.FindAndStartActors(); app.Run(async context => { await context.Response.WriteAsync($"Hello World!"); }); }