本文整理汇总了C#中DatabaseContext.InitializeStoreDatabaseAsync方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseContext.InitializeStoreDatabaseAsync方法的具体用法?C# DatabaseContext.InitializeStoreDatabaseAsync怎么用?C# DatabaseContext.InitializeStoreDatabaseAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseContext
的用法示例。
在下文中一共展示了DatabaseContext.InitializeStoreDatabaseAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
ConfigureMappers();
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole(LogLevel.Verbose);
loggerFactory.AddDebug(LogLevel.Verbose);
// Configure the HTTP request pipeline.
// Add the following to the request pipeline only in development environment.
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// Add Error handling middleware which catches all application specific errors and
// send the request to the following path or controller action.
app.UseExceptionHandler("/Home/Error");
}
// Add static files to the request pipeline.
app.UseStaticFiles();
// Add cookie-based authentication to the request pipeline
app.UseIdentity();
// Add MVC to the request pipeline.
app.UseMvc(routes =>
{
//routes.MapRoute("areaRoute", "{area:exists}/{controller}/{action}");
routes.MapRoute(
name: "areaRoute",
template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "controllerActionRoute",
template: "{controller=Home}/{action=Index}/{id?}");
// routes.MapRoute(
// name: "departamentos",
// template: "{area:exists}/{controller}/{action}/{sigla?}");
routes.MapRoute(
"controllerRoute",
"{controller}",
new { controller = "Home" });
// After all your routes
routes.MapRoute(
"DeepLink",
"{*pathInfo}",
defaults: new { controller = "SPA", action = "Index" });
// Uncomment the following line to add a route for porting Web API 2 controllers.
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
});
if (System.IO.File.Exists("singl.sqlite"))
{
System.Console.WriteLine("Deleted singl.sqlite");
System.IO.File.Delete("singl.sqlite");
}
using (var context = new DatabaseContext())
{
context.InitializeStoreDatabaseAsync(app.ApplicationServices).Wait();
}
}