Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, FangHuaHostDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            // 根据Migrations修改/创建数据库
            new DbInitializer().InitializeAsync(context);

            // 开启全局异常捕获
            //app.UseMiddleware<ExceptionHandlerMiddleware>();
            app.UseMiddleware(typeof(ExceptionHandlerMiddleware));

            app.UseHttpsRedirection();

            // JWT
            app.UseAuthentication();

            // 开启跨域
            app.UseCors("CustomCorsPolicy");

            app.UseMvc();

            #region Swagger

            // 启用中间件服务生成Swagger作为JSON终结点
            app.UseSwagger();
            // 启用中间件服务对Swagger-UI,指定Swagger JSON终结点
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint($"/swagger/{Version}/swagger.json", "默认接口文档");
                // 路径配置,设置为空,表示直接访问该文件
                c.RoutePrefix = "";
            });

            #endregion Swagger
        }
 public GuidePagesMenuInfoAppService(FangHuaHostDbContext context)
 {
     _context = context;
 }
 public BackGroundImageInfoAppService(FangHuaHostDbContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public DevLoveInfoAppService(FangHuaHostDbContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public AccessHistoryLogAppService(FangHuaHostDbContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 public AdminAppService(FangHuaHostDbContext context)
 {
     _context = context;
 }
 public CopywritingInfoAppService(FangHuaHostDbContext context)
 {
     _context = context;
 }
 public EmailHistoryInfoAppService(FangHuaHostDbContext context)
 {
     _context       = context;
     _emailServices = new EmailServices();
 }
Esempio n. 9
0
 public void InitializeAsync(FangHuaHostDbContext context)
 {
     // 根据Migrations修改/创建数据库
     context.Database.MigrateAsync();
 }