Hello. I don't know how to just ask the question.
When I run update-database, a database is created. However, without the table __Migrations (or whatever its name was). The database is up-to-date.
When I then execute update database, the above table is created. but has only the first entry. I think because the update stopped there. Who can help?
public async Task SeedAsync()
{
if (!DBContext.Database.EnsureCreated())
DBContext.Database.Migrate();
}public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, DataService seeder)
{
loggerFactory.AddFile("Logs/myapp-{Date}.txt");
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseAuthentication();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
// here you can see we make sure it doesn't start with /api, if it does,
// it'll 404 within .NET if it can't be found
app.MapWhen(x => !x.Request.Path.Value.StartsWith("/api"), builder =>
{
builder.UseMvc(routes =>
{
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
});
seeder.SeedAsync().Wait();
}