mercredi 26 juillet 2017

Data access and models (CQRS)

I'm creating REST API (ASP.NET Core). I decided to use CQRS (without eventsourcing) in this project.

The project will be separated to many small libs. Each library will be responsible for specific feature.

In my past projects I used repository pattern to abstract from data storage. How should I abstract from data storage using CQRS? Or I shouldn't? For example, I have small library which contains queries and commands to work with users. Should I directly write SQL inside a query or a command?

Next question is about models. In my past projects was models library. Each model inside the library had the same structure as DB tables. If I understand correctly, in CQRS I must create model for each command and query. Do I need view models in this case?

Aucun commentaire:

Enregistrer un commentaire