Skip to content

Instantly share code, notes, and snippets.

@bjornmicallef
Last active December 11, 2020 08:57
Show Gist options
  • Save bjornmicallef/28dbf51ac7aa7d8c405dc0e15f53827a to your computer and use it in GitHub Desktop.
Save bjornmicallef/28dbf51ac7aa7d8c405dc0e15f53827a to your computer and use it in GitHub Desktop.
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