SES-65 #5
@ -24,19 +24,24 @@ namespace SessionCompanion
|
|||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddControllersWithViews();
|
services.AddControllersWithViews();
|
||||||
|
services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
|
options.UseSqlServer(
|
||||||
|
Configuration.GetConnectionString("DefaultConnection")));
|
||||||
// In production, the Angular files will be served from this directory
|
// In production, the Angular files will be served from this directory
|
||||||
services.AddSpaStaticFiles(configuration =>
|
services.AddSpaStaticFiles(configuration =>
|
||||||
{
|
{
|
||||||
|
|||||||
configuration.RootPath = "ClientApp/dist";
|
configuration.RootPath = "ClientApp/dist";
|
||||||
});
|
});
|
||||||
services.AddDbContext<ApplicationDbContext>(options =>
|
|
||||||
options.UseSqlServer(
|
|
||||||
Configuration.GetConnectionString("DefaultConnection")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s426135 marked this conversation as resolved
s426134
commented
Brakuje wywołania migracji Brakuje wywołania migracji
|
|||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
|
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope())
|
||||||
|
{
|
||||||
|
serviceScope.ServiceProvider.GetService<ApplicationDbContext>().Database.Migrate();
|
||||||
|
}
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
Loading…
Reference in New Issue
Block a user
Przenieś to linijkę wyżej. Po bazie będzie robiony swagger. Dopiero po Swaggerze mogą zostać dodane pliki statyczne. Inaczej mogłoby dojśc do sytuacj, że front nie otrzymałby pełnych informacji o swaggerze.
Linijke wyżej czyli wewnątrz
services.AddSpaStaticFiles(configuration =>
?
czy jeszcze przed tym?
Przed