添加工作单元
This commit is contained in:
@@ -16,6 +16,7 @@ using Yi.Framework.Job;
|
||||
using Yi.Framework.Language;
|
||||
using Yi.Framework.Model.Models;
|
||||
using Yi.Framework.Repository;
|
||||
using Yi.Framework.Uow.Interceptors;
|
||||
using Yi.Framework.WebCore;
|
||||
using Yi.Framework.WebCore.AttributeExtend;
|
||||
using Yi.Framework.WebCore.AuthorizationPolicy;
|
||||
@@ -62,10 +63,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
ThumbnailSharpInvoer thumbnailSharpInvoer,
|
||||
CacheInvoker cacheInvoker) =>
|
||||
|
||||
(_logger,_iUserService, _iRoleService, _quartzInvoker, _hub, _local, _thumbnailSharpInvoer, _cacheDb) =
|
||||
(_logger, _iUserService, _iRoleService, _quartzInvoker, _hub, _local, _thumbnailSharpInvoer, _cacheDb) =
|
||||
|
||||
(logger, iUserService, iRoleService, quartzInvoker, hub, local, thumbnailSharpInvoer, cacheInvoker);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// swagger跳转
|
||||
@@ -109,6 +110,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
return Result.Success().SetData(await _iUserService.DbTest());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<Result> TestUnitOfWork()
|
||||
{
|
||||
var userId = await _iUserService.AddInfo(new DTOModel.UserInfoDto { User = new UserEntity { Address = "", UserName = "lisi", Password = "123456" }.BuildPassword() });
|
||||
throw new ApplicationException("测试uow");
|
||||
await _iRoleService._repository.InsertReturnSnowflakeIdAsync(new RoleEntity { RoleName = "测试", RoleCode = "tt" });
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行Sql返回
|
||||
/// </summary>
|
||||
|
||||
@@ -18,6 +18,9 @@ using Yi.Framework.WebCore.LogExtend;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Yi.Framework.WebCore.AutoFacExtend;
|
||||
using AspectCore.Extensions.DependencyInjection;
|
||||
using AspectCore.Extensions.Hosting;
|
||||
using Yi.Framework.Uow.Interceptors;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Configuration.AddCommandLine(args);
|
||||
@@ -31,6 +34,9 @@ builder.Host.ConfigureAppConfiguration((hostBuilderContext, configurationBuilder
|
||||
#endregion
|
||||
configurationBuilder.AddApolloService("Yi");
|
||||
});
|
||||
|
||||
builder.Services.AddUnitOfWork();
|
||||
|
||||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
||||
{
|
||||
@@ -47,6 +53,7 @@ builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
||||
#endregion
|
||||
containerBuilder.AddAutoIocService("Yi.Framework.Repository", "Yi.Framework.Service");
|
||||
});
|
||||
|
||||
////<2F><><EFBFBD><EFBFBD>ע<EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mvcģ<63><C4A3>ת<EFBFBD>Ӹ<EFBFBD>ioc
|
||||
builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
|
||||
|
||||
@@ -154,6 +161,7 @@ builder.Services.AddHttpContextAccessor();
|
||||
#endregion
|
||||
builder.Services.AddSingleton<ThumbnailSharpInvoer>();
|
||||
|
||||
|
||||
#region
|
||||
//ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC>ֵ
|
||||
#endregion
|
||||
@@ -237,6 +245,5 @@ app.UseEndpoints(endpoints =>
|
||||
endpoints.MapHub<MainHub>("/api/hub/main");
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
|
||||
//<><D7BC><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6>⻧
|
||||
app.Run();
|
||||
@@ -21,6 +21,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.WebCore\Yi.Framework.WebCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user