Slicing Persistence Adapters

Learn how to slice persistence adapters.

In the previous lesson, we have seen a single persistence adapter class that implements all persistence ports. There is no rule, however, that forbids us to create more than one class as long as all persistence ports are implemented.

We might choose, for instance, to implement one persistence adapter per domain class for which we need persistence operations (or “aggregate” in DDD lingo), as shown in the figure below.

Adapter per aggregate

Get hands-on with 1200+ tech skills courses.