This example shows another variation of the Dog
aggregate class.
Like the previous example, this example uses the Aggregate
class from the
library. Event classes are defined explicitly to match command method signatures.
In contrast to the previous example, this example explicitly triggers events within
the command method bodies, and separately applies the events to the aggregate using
singledispatchmethod
.
Like in the previous examples, the application code simply uses the aggregate class as if it were a normal Python object class.
.. literalinclude:: ../../../eventsourcing/examples/aggregate3/domainmodel.py
.. literalinclude:: ../../../eventsourcing/examples/aggregate3/application.py
.. literalinclude:: ../../../eventsourcing/examples/aggregate3/test_application.py