283
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns
I think it might be worth mentioning testing here
–
it provides a nice consistent window into the
behavior of your system. Request-in,
response-
out. We’ve found that aspect quite valuable in building
consistently behaving tests.
First, let’s look at a sample WebAPI controller where you actually would use the mediator object. If
you we
ren’t using the mediator object, you’d need to inject all the dependencies
for that controller,
things like a logger object and others. Therefore, the constructor would be complicated. On the other
hand, if you use the mediator object, the constructor of your controller can
be a lot simpler, with just a
few dependencies instead of many dependencies if you had one per cross-cutting operation, as in the
following example:
Dostları ilə paylaş: