Questions about UnitWork
s446683009 opened this issue · comments
s446683009 commented
I am a DDD beginner,In my opinion, the repository is responsible for storing and reading entities, and it isolates the direct dependency of the business on the database. Therefore, its updates should be directly updated to the database. I don't understand why it is necessary to call UnitWork to save. UnitWork should be a switch. When multiple repository operations are involved, Begin, and finally commit to the database. If I don't use EF but ADO, I don't know how to implement UnitWork's SaveEntitiesAsync.
_orderRepository.Add(order);
return await _orderRepository.UnitOfWork
.SaveEntitiesAsync(cancellationToken);