dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.

Home Page:https://dot.net/architecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inject Ordering Context rather than Unit Of Work in Transaction Behavior to create Transaction in Db

zakaria-hajeid opened this issue · comments

Hello, I have a question about why you depend on Ordering context in Transaction Behavior To (BeginTransactionAsync)
Why the transaction operation are put in ordering context ? in this case you can use the data access layer in application layer
why not depend on UnitOfWork abstraction to create transaction and manage the transaction ?

issue

i have the same question

I have the same question as well, would be nice if someone would clarify this. In our company we keep copy-pasting this Transaction behavior in all the repo we have and I don't understand how we can make this generic.

I have a DomainContext which is a generic implementation of the "OrderingContext". So in every domain repository we have, we create a db context and inherit this DomainContext.
However MediatR is not able to resolve the generic DomainContext.