配置文件开关,数据库读写分离
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<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
services.AddSqliteService();
|
||||
|
||||
#region
|
||||
//MySql<71><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
services.AddMysqlService();
|
||||
services.AddDbService();
|
||||
|
||||
#region
|
||||
//Redis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endregion
|
||||
//services.AddRedisService();
|
||||
services.AddRedisService();
|
||||
|
||||
#region
|
||||
//RabbitMQ<4D><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#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
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
//app.UseHealthCheckMiddleware();
|
||||
app.UseHealthCheckMiddleware();
|
||||
|
||||
#region
|
||||
//<2F><>Ȩע<C8A8><D7A2>
|
||||
@@ -134,12 +130,12 @@ namespace Yi.Framework.ApiMicroservice
|
||||
#region
|
||||
//Consul<75><6C><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
//app.UseConsulService();
|
||||
app.UseConsulService();
|
||||
|
||||
#region
|
||||
//<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||
#endregion
|
||||
app.UseDbSeedInitService(_Db);
|
||||
app.UseDbSeedInitService(_DbFactory);
|
||||
|
||||
#region
|
||||
//Endpointsע<73><D7A2>
|
||||
|
||||
Reference in New Issue
Block a user