当前位置: 首页>>代码示例>>C#>>正文


C# DatabaseContext.InitializeStoreDatabaseAsync方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:thild,项目名称:singl,代码行数:71,代码来源:Startup.cs


注:本文中的DatabaseContext.InitializeStoreDatabaseAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。