public IServiceProvider ConfigureServices(IServiceCollection services) { this.config = new BoardlessWebConfig(this.configurationRoot); services.AddWebApiService(this.config); services.AddMvc().AddControllersAsServices(); var builder = new AutofacBuilder(); builder.Populate(services); builder.RegisterModule(new BoardlessWebDIModule(this.executeAssembly, this.rootPath, this.configurationRoot, this.loggerFactory)); var scope = builder.Build(); var migrationService = scope.Resolve <IMigrationUseCase>(); migrationService.ExecuteAsync().GetAwaiter().GetResult(); return(builder.CreateServiceProvider()); }