Hello @hikalkan ,
I have question about trigger event.
In the following example
You trigger event on line 114
After following example
You updating product on line 74 like below
public async Task
{
var product = await _productRepository.GetAsync(id);
pp
product.SetName(input.Name);
product.SetPrice(input.Price);
product.SetStockCount(input.StockCount);
product.SetImageName(input.ImageName);
return ObjectMapper.Map<Product, ProductDto>(product);
}
I was wondering if product.SetImageName(input.ImageName); line throw exception, will it still trigger ProductStockCountChangedEto event?
You trigger event on line 114
We add event on line 114.
I was wondering if product.SetImageName(input.ImageName); line throw exception, will it still trigger ProductStockCountChangedEto event?
No, it will not. Distributed events are triggered after SaveChanges/SaveChangesAsync.
Most helpful comment
We add event on line 114.
https://github.com/abpframework/abp/blob/ac69dc0a0aecbac09874f7a1f9aac8fe49e37a97/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/Product.cs#L114
No, it will not. Distributed events are triggered after
SaveChanges/SaveChangesAsync.https://github.com/abpframework/abp/blob/d16bef05b22ad8ac2c02676dae273852fd86b6f3/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs#L149-L151