diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db
index bd53f8e8..d7568068 100644
Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ
diff --git a/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs b/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs
index ddf1d1cf..cfa20c1f 100644
--- a/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Repository/Repository.cs
@@ -14,14 +14,13 @@ namespace Yi.Framework.Repository
///
public class Repository : SimpleClient, IRepository where T : class, IBaseModelEntity, new()
{
- public ISqlSugarClient _Db { get; set; }
+ public ISqlSugarClient _Db { get { return base.Context; } set { } }
///
/// 构造函数
///
///
public Repository(ISqlSugarClient context) : base(context)//注意这里要有默认值等于null
{
- _Db = context;
}
///
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs b/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
index 3def6588..52546893 100644
--- a/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Service/RoleService.cs
@@ -9,18 +9,13 @@ namespace Yi.Framework.Service
{
public partial class RoleService
{
- private IRepository _repositoryRoleMenu;
- public RoleService(IRepository repository, IRepository repositoryRoleMenu) : base(repository)
- {
- _repository = repository;
- _repositoryRoleMenu = repositoryRoleMenu;
- }
public async Task> DbTest()
{
return await _repository._Db.Queryable().ToListAsync();
}
public async Task GiveRoleSetMenu(List roleIds, List menuIds)
{
+ var _repositoryRoleMenu= _repository.ChangeRepository>();
//多次操作,需要事务确保原子性
return await _repositoryRoleMenu.UseTranAsync(async () =>
{