Commit f38115e4 authored by gdlcf88's avatar gdlcf88

Fix unit of work

parent 98d5f474
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
......
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
......
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
......
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
......
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
......
......@@ -8,6 +8,7 @@ using Volo.Abp.EventBus;
using Volo.Abp.Guids;
using Volo.Abp.Json;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Products.ProductDetailHistories
{
......@@ -30,7 +31,8 @@ namespace EasyAbp.EShop.Products.ProductDetailHistories
_productDetailHistoryRepository = productDetailHistoryRepository;
}
public async Task HandleEventAsync(EntityChangedEventData<ProductDetail> eventData)
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityChangedEventData<ProductDetail> eventData)
{
var modificationTime = eventData.Entity.LastModificationTime ?? eventData.Entity.CreationTime;
......
......@@ -7,6 +7,7 @@ using Volo.Abp.EventBus;
using Volo.Abp.Guids;
using Volo.Abp.Json;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Products.ProductHistories
{
......@@ -29,7 +30,8 @@ namespace EasyAbp.EShop.Products.ProductHistories
_productHistoryRepository = productHistoryRepository;
}
public async Task HandleEventAsync(EntityChangedEventData<Product> eventData)
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityChangedEventData<Product> eventData)
{
var modificationTime = eventData.Entity.LastModificationTime ?? eventData.Entity.CreationTime;
......
......@@ -31,12 +31,12 @@ namespace EasyAbp.EShop.Products.Products
_productManager = productManager;
}
[UnitOfWork(true)]
public virtual async Task HandleEventAsync(EntityCreatedEto<OrderEto> eventData)
{
var uow = _unitOfWorkManager.Current;
using (_currentTenant.Change(eventData.Entity.TenantId))
{
using var uow = _unitOfWorkManager.Begin(true, true);
foreach (var orderLine in eventData.Entity.OrderLines)
{
var product = await _productRepository.FindAsync(orderLine.ProductId);
......@@ -69,7 +69,6 @@ namespace EasyAbp.EShop.Products.Products
}
}
await uow.CompleteAsync();
await _distributedEventBus.PublishAsync(new ProductInventoryReductionAfterOrderPlacedResultEto
{OrderId = eventData.Entity.Id, IsSuccess = true});
}
......
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment