0
ademaygun created
- ABP Framework version: v5.3.3
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:"
I am debugging the code below. When I check the database after executing the CompleteAsync()
command, I observe that there is no change. The change only occurs when the method is completed. Don't you think this is misleading?
public async Task UpdateAsync(string name)
{
List<string> myList = new() { "1", "2" };
foreach (var id in myList)
{
using (var uow = unitOfWorkManager.Begin(isTransactional: true))
{
var product = await productRepository.GetAsync(id);
product.SetName(name);
await productRepository.UpdateAsync(product);
await uow.CompleteAsync();
}
}
}
3 Answer(s)
-
0
hi This is because the
UpdateAsync
is already in a unit of work. -
0
Hi, Even though
await uow.CompleteAsync();
is being called, it is not performing any operation. In this case, I would expect it to write(commit) to the database or throw an error. -
0