使用sqlsugar内置工作单元

This commit is contained in:
chenchun
2023-01-02 13:59:05 +08:00
parent 0e78857645
commit ea35871aba
16 changed files with 65 additions and 58 deletions

View File

@@ -8,7 +8,6 @@ using Yi.Framework.Interface;
using Yi.Framework.Model.RABC.Entitys;
using Yi.Framework.Repository;
using Yi.Framework.Service.Base;
using Yi.Framework.Uow.Interceptors;
using Yi.Framework.Interface.RABC;
using Yi.Framework.DTOModel.Base.Dto;
@@ -21,17 +20,11 @@ namespace Yi.Framework.Service.RABC
}
public async Task<List<RoleEntity>> DbTest()
{
return await _repository._Db.Queryable<RoleEntity>().ToListAsync();
}
//添加工作单元特性
[UnitOfWork]
public async Task<bool> UowTest()
{
var res = await _repository.InsertReturnSnowflakeIdAsync(new RoleEntity { RoleName = "测试", RoleCode = "tt" });
throw new ApplicationException("测试uow");
return res > 0;
return await _repository._DbQueryable.ToListAsync();
}
public async Task<bool> GiveRoleSetMenu(List<long> roleIds, List<long> menuIds)
{
var _repositoryRoleMenu = _repository.ChangeRepository<Repository<RoleMenuEntity>>();

View File

@@ -10,7 +10,6 @@
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Interface\Yi.Framework.Interface.csproj" />
<ProjectReference Include="..\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
</ItemGroup>
<ItemGroup>