mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-20 08:26:37 +08:00
配置文件开关,数据库读写分离
This commit is contained in:
@@ -5,16 +5,22 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Enum;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Model.ModelFactory;
|
||||
|
||||
namespace Yi.Framework.Service
|
||||
{
|
||||
public class BaseService<T> : IBaseService<T> where T : class, new()
|
||||
{
|
||||
public DbContext _Db;
|
||||
public BaseService(DbContext Db)
|
||||
public DbContext _Db2;
|
||||
public IDbContextFactory _DbFactory;
|
||||
public BaseService(IDbContextFactory DbFactory)
|
||||
{
|
||||
_Db = Db;
|
||||
_DbFactory = DbFactory;
|
||||
_Db = DbFactory.ConnWriteOrRead(WriteAndReadEnum.Write);
|
||||
_Db2 = DbFactory.ConnWriteOrRead(WriteAndReadEnum.Read);
|
||||
}
|
||||
|
||||
public async Task<T> GetEntityById(int id)
|
||||
|
||||
Reference in New Issue
Block a user