#1 2020-08-14 18:15:11

fabiovip2019
Member
Registered: 2019-03-14
Posts: 76

Use of the mediator with mormot

Hi Ab, I was working on my implementation with mormot and I realized that my application layer is strongly attached to my domain layer. I'm using the MormotDDD unit (I think it's incredible) but in my queries and commands I pass as parameter for the aggregates. That is, I need to bring my aggregates to the application layer because queries and commands need their instance. Is there a way to solve this with mormot? A mediator maybe, or don't you see it in a bad way?

Offline

#2 2020-08-14 19:43:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Use of the mediator with mormot

The idea is to write your DTOs according to the extact use cases of the public API.
We use records and dynamic arrays for this purpose.
In practice, we rather use manual methods in the DTO to convert from the domain values to the DTOs fields. Such code is not error-prone, and easy to write, even if a bit verbose.

Offline

#3 2020-08-17 12:32:51

fabiovip2019
Member
Registered: 2019-03-14
Posts: 76

Re: Use of the mediator with mormot

Oi Ab,
I am using packed record for dtos, they are all anemic. Which case of api public do you refer to? I am using the standard assembler for the conversion of these data. But even in this way, I have a strong coupling between domain layer and application.

Offline

#4 2020-08-17 14:05:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Use of the mediator with mormot

The domain layer is used in the application layer, which publishes only its own DTOs.
The application layer is a layer on the server side, which is called by the actual client applications: web, native....
The application layer service uses one or several domains, and does the link between them.
In the client application itself, there are only those DTOs.

Check the doc about the "DDD Clean architecture".

Offline

#5 2020-08-18 20:04:02

fabiovip2019
Member
Registered: 2019-03-14
Posts: 76

Re: Use of the mediator with mormot

This ok is exactly what I'm doing, my application layer is a link to the domains, to perform aggregate conversion for Dtos I'm using something like pattern assembler for these conversions. So I'm doing the truck back from the household to Assembler, doesn't it sound strange to you?
I would like to congratulate you for the Excellent framework.

Offline

#6 2020-08-19 06:24:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Use of the mediator with mormot

You are right: the application layer will definitively use pattern assembler for the DTOs.

Offline

Board footer

Powered by FluxBB