dotnet / dotnet/eShop

Questions about UnitWork

Open
#362 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.9k
Forks
3.8k
Avg merge
1d 11h
Merged PRs (30d)
4

Description

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.

```c#

_orderRepository.Add(order);
return await _orderRepository.UnitOfWork
.SaveEntitiesAsync(cancellationToken);

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.