Last active
December 11, 2020 08:57
-
-
Save bjornmicallef/28dbf51ac7aa7d8c405dc0e15f53827a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddControllers(); | |
services.AddDbContext<StockNotificationContext>(options => options.UseInMemoryDatabase(databaseName: "StockNotification")); | |
services.AddScoped<IUserSettingsService, UserSettingsService>(); | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
// this should be here when you create the solution | |
app.UseHttpsRedirection(); | |
app.UseRouting(); | |
app.UseAuthorization(); | |
app.UseEndpoints(endpoints => | |
{ | |
endpoints.MapControllers(); | |
}); | |
using (var serviceScope = app.ApplicationServices.CreateScope()) | |
{ | |
var dbContext = serviceScope.ServiceProvider.GetService<StockNotificationContext>(); | |
tblSellersBuilder.Initialize(dbContext); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment