mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-18 07:06:36 +08:00
配置文件开关,数据库读写分离
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Yi.Framework.Model.ModelFactory;
|
||||
using Yi.Framework.WebCore.MiddlewareExtend;
|
||||
using Yi.Framework.WebCore.Utility;
|
||||
|
||||
@@ -49,24 +50,19 @@ namespace Yi.Framework.ApiMicroservice
|
||||
services.AddJwtService();
|
||||
|
||||
#region
|
||||
//Sqlite服务配置
|
||||
//数据库配置
|
||||
#endregion
|
||||
services.AddSqliteService();
|
||||
|
||||
#region
|
||||
//MySql服务配置
|
||||
#endregion
|
||||
services.AddMysqlService();
|
||||
services.AddDbService();
|
||||
|
||||
#region
|
||||
//Redis服务配置
|
||||
#endregion
|
||||
//services.AddRedisService();
|
||||
services.AddRedisService();
|
||||
|
||||
#region
|
||||
//RabbitMQ服务配置
|
||||
#endregion
|
||||
//services.AddRabbitMQService();
|
||||
services.AddRabbitMQService();
|
||||
|
||||
|
||||
}
|
||||
@@ -82,7 +78,7 @@ namespace Yi.Framework.ApiMicroservice
|
||||
#endregion
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env,DbContext _Db)
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env,IDbContextFactory _DbFactory)
|
||||
{
|
||||
//if (env.IsDevelopment())
|
||||
{
|
||||
@@ -119,7 +115,7 @@ namespace Yi.Framework.ApiMicroservice
|
||||
#region
|
||||
//健康检查注入
|
||||
#endregion
|
||||
//app.UseHealthCheckMiddleware();
|
||||
app.UseHealthCheckMiddleware();
|
||||
|
||||
#region
|
||||
//鉴权注入
|
||||
@@ -134,12 +130,12 @@ namespace Yi.Framework.ApiMicroservice
|
||||
#region
|
||||
//Consul服务注入
|
||||
#endregion
|
||||
//app.UseConsulService();
|
||||
app.UseConsulService();
|
||||
|
||||
#region
|
||||
//数据库种子注入
|
||||
#endregion
|
||||
app.UseDbSeedInitService(_Db);
|
||||
app.UseDbSeedInitService(_DbFactory);
|
||||
|
||||
#region
|
||||
//Endpoints注入
|
||||
|
||||
Reference in New Issue
Block a user