using Admin.NET.Application.Const; using Furion.DatabaseAccessor; using Microsoft.AspNetCore.Authorization; namespace Admin.NET.Application.Serice; /// /// 自己业务服务 /// [ApiDescriptionSettings(TestConst.GroupName, Name = "XXX模块", Order = 200)] [AllowAnonymous] public class TestService : IDynamicApiController, ITransient { private readonly SqlSugarRepository _testRep; public TestService(SqlSugarRepository testRep) { _testRep = testRep; } /// /// 获取列表 /// /// [HttpGet("/test/list")] public async Task> GetTestList() { return await _testRep.GetListAsync(); } /// /// 事务和工作单元测试 /// /// [HttpGet("/test/list2")] [UnitOfWork] public async Task> TestUnitOfWork() { await _testRep.InsertAsync(new Test() { Name = "admin" }); var a = 0; var b = 1 / a; return await _testRep.GetListAsync(); } }