C
C
csharpnoob2017-09-07 13:29:43
C++ / C#
csharpnoob, 2017-09-07 13:29:43

CQRS, decorators and data access?

In my application, I decided to use the CQRS approach.
The application is written in C# (ASP.NET Core). I use Dapper to access data.
CQRS implemented as follows:
ICommand - command
ICommandHandler - command handler
ICommandDispatcher - finds a handler for a command.
Decorators may be added to command handlers in the future.
The entire application is divided into modules, each of which works with its own database.
Question: how to abstract from a specific database? What about the decorator for transactions? Eg. I will write a factory that will return a database connection. But it turns out that I will ask this factory twice for a connection (in the main handler and in the decorator).

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question