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.
https://dot.net/architecture
24.58k stars 10.36k forks source link

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

Open zakaria-hajeid opened 9 months ago

zakaria-hajeid commented 9 months ago

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

aymancs85 commented 9 months ago

i have the same question

Vinko90 commented 8 months ago

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.