In front of me lies a web API project, which is to be modernized and newly implemented. In this project I want to use a vertical slice architecture, because the layered architecture does not fit our feature-oriented approach. Also, things like the repository would become very large.
So I started to implement the project using CQRS, but now I realize that this is not appropriate either, because we have commands that need to return DTO's. This is to avoid multiple unnecessary database accesses or (as in example 1) there is no database access at all, but the result is different after each call (unlike a query).
/// Example 1: Create access token and return the result directly, no database access (no query possible)
AssetsAccessToken token = await this.createAccessTokenCommandHandler.Handle(accessTokenCommand);
/// Example 2: Create or get available storage space.
AssetsStorageSpace storage = await this.createOrGetStorageSpaceCommandHandler.Handle(storageSpaceCommand);
Are there alternative software architectures for vertical slices that can solve these problems?
Aucun commentaire:
Enregistrer un commentaire