配置文件开关,数据库读写分离

This commit is contained in:
橙子
2021-10-26 15:09:07 +08:00
parent b29b6be734
commit 5d5452b531
30 changed files with 397 additions and 163 deletions

View File

@@ -10,6 +10,7 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Yi.Framework.Model.ModelFactory;
using Yi.Framework.WebCore.Utility;
using Module = Autofac.Module;
@@ -19,6 +20,9 @@ namespace Yi.Framework.WebCore.Utility
{
protected override void Load(ContainerBuilder containerBuilder)
{
containerBuilder.RegisterType<DbContextFactory>().As<IDbContextFactory>().InstancePerDependency().EnableInterfaceInterceptors();
var basePath = AppContext.BaseDirectory;
var servicesDllFile = Path.Combine(basePath, "Yi.Framework.Service.dll");
if (!(File.Exists(servicesDllFile)))
@@ -41,7 +45,7 @@ namespace Yi.Framework.WebCore.Utility
//containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).InstancePerDependency().EnableInterfaceInterceptors();
}