Skip to main content

Questions tagged [unit-of-work]

The tag has no usage guidance.

4 votes
2 answers
522 views

Is the entire web request the right scope for a DbContext in EF Core?

The usual advice for using EF Core in a web application is to use a scoped DbContext per HTTP request. This is even the suggested default for web application in the Microsoft documentation. I recently ...
Mad Scientist's user avatar
2 votes
1 answer
228 views

two diffrent database in unit of work

I will explain my problem in the form of an example. Suppose we want to use both databases in a transaction. Data is edited in database 1 (for example, Postgres) and then added to database 2. Finally, ...
Amir Hosein's user avatar
1 vote
2 answers
321 views

Using multiple databases in a bounded context

Sometimes we have to use multiple databases in one project with the intentions of: Denormalizing data or read models Using the advantages of that database (technology) There has been a lot of talk ...
PersianMan's user avatar
0 votes
0 answers
238 views

Implementing the Repository/UnitOfWork pattern using Azure.Data.Tables "TableClient"

I currently have a generic Azure repository AzureRepository<TEntity> store internally a list of table transaction actions like so. private readonly IList<TableTransactionAction> ...
Reap's user avatar
  • 183
0 votes
1 answer
3k views

Where to put SaveChanges in unit of work?

For the sake of discussion, you can assume I'm using Entity Framework and a mediator pattern implementation in .NET. I'm going back and forth trying to decide how to structure some of my data access ...
Alexander Trauzzi's user avatar
6 votes
3 answers
14k views

Is unit of work pattern really needed with repository pattern

I am trying to use EF6 with my project. I just watched Repository Pattern with C# and Entity Framework, Done Right | Mosh video. I understand the necessity of Repositories but I still don't understand ...
Mansur Ali Koroglu's user avatar
8 votes
2 answers
7k views

Avoiding Repository pattern - implementing Onion Architecture with DbContext only

I am trying to follow the Onion Architecture to design my application where I have the following layers - Domain Layer: is the inner-most layer and defines repository interfaces Infrastructure ...
atiyar's user avatar
  • 203
0 votes
2 answers
3k views

c# Manage more Repository in UnitOfWork

I have a question about how can manage multiple repositories with unit of work. I thought for two solutions but I'm not sure. The first is a classic solution where the IUnitOfWork interface looks like ...
pampua84's user avatar
  • 133
3 votes
1 answer
775 views

Saga vs. Unit of work

What's the relationship between the two? Both are for atomic operations. Both results need to be either success, or failure with rollback to original state.
Wei Huang's user avatar
  • 265
-1 votes
1 answer
3k views

Update Entity for Repository Pattern and UOW Pattern C#

In one mock solution, I have created 3 mock projects to implement layered architecture design mainly the - Presentation Layer (Web) - Domain Model Layer - Infrastructure Layer. I haven't yet to add ...
Steve's user avatar
  • 299
1 vote
2 answers
1k views

How to get ORM (Ef Core) Entities follow a DDD style . Which is the best approach?

I am considering mutliple options to face a problem. I want to develop software following DDD style. The problem arise when I have to define my entities and I am working with Entity Framework Core, ...
X.Otano's user avatar
  • 622
1 vote
3 answers
681 views

Tracking state on entity and unit-of-work pattern

In my web app I have a long running operation that is processing some entity in the background. The state of this process should be visible to the clients. During the processing the UI should show ...
Dejan's user avatar
  • 119
3 votes
2 answers
1k views

Should a UnitOfWork contain every Repository?

I'm trying to get the Repository/UnitOfWork pattern figured out. We're working on a project with EntityFramework and our DBContext contains 200+ tables. Right now our approach is to inject whatever ...
Winetradr's user avatar
5 votes
2 answers
17k views

Unit Of Work with multiple database context

I have created an application (net core 2 & ef core) with Unit Of Work and Generic repository pattern. I used to have one database context but due to some business logic I had to create a second ...
Dimitris's user avatar
3 votes
2 answers
3k views

Unit of work + repository pattern + dependency injection

I am in the process of refactoring and improving a codebase. One of the major missing features is transactional safety and certain errors arising from each repository having its own DbContext. The ...
Flater's user avatar
  • 52.8k

15 30 50 per page