修复代理问题
This commit is contained in:
Binary file not shown.
@@ -14,14 +14,13 @@ namespace Yi.Framework.Repository
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class Repository<T> : SimpleClient<T>, IRepository<T> where T : class, IBaseModelEntity, new()
|
||||
{
|
||||
public ISqlSugarClient _Db { get; set; }
|
||||
public ISqlSugarClient _Db { get { return base.Context; } set { } }
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
public Repository(ISqlSugarClient context) : base(context)//注意这里要有默认值等于null
|
||||
{
|
||||
_Db = context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,18 +9,13 @@ namespace Yi.Framework.Service
|
||||
{
|
||||
public partial class RoleService
|
||||
{
|
||||
private IRepository<RoleMenuEntity> _repositoryRoleMenu;
|
||||
public RoleService(IRepository<RoleEntity> repository, IRepository<RoleMenuEntity> repositoryRoleMenu) : base(repository)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryRoleMenu = repositoryRoleMenu;
|
||||
}
|
||||
public async Task<List<RoleEntity>> DbTest()
|
||||
{
|
||||
return await _repository._Db.Queryable<RoleEntity>().ToListAsync();
|
||||
}
|
||||
public async Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds)
|
||||
{
|
||||
var _repositoryRoleMenu= _repository.ChangeRepository<Repository<RoleMenuEntity>>();
|
||||
//多次操作,需要事务确保原子性
|
||||
return await _repositoryRoleMenu.UseTranAsync(async () =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user