This commit is contained in:
454313500@qq.com
2021-03-28 20:56:27 +08:00
parent 1bdeb1d6a4
commit b1549f00b6
3 changed files with 17 additions and 4 deletions

View File

@@ -75,11 +75,21 @@ namespace CC.Yi.API
}).AddEntityFrameworkStores<DataContext>().AddDefaultTokenProviders();
}
private void InitData(IServiceProvider serviceProvider)
{
var serviceScope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope();
var context = serviceScope.ServiceProvider.GetService<DataContext>();
DbContentFactory.Initialize(context);//<2F><><EFBFBD>þ<EFBFBD>̬<EFBFBD><EFBFBD><E0B7BD>ע<EFBFBD><D7A2>
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
@@ -99,6 +109,7 @@ namespace CC.Yi.API
{
endpoints.MapControllers();
});
InitData(app.ApplicationServices);
}
}
}