Last active
December 3, 2022 04:34
-
-
Save leegilmorecode/2562e1d3c7a5003067b46e0d46ffb31b to your computer and use it in GitHub Desktop.
Example aggregate root abstract base entity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DomainEvent } from './domain-event'; | |
import { Entity } from './entity'; | |
// denotes visually that this entity is the aggregate root | |
// and stores the overall domain events for publishing | |
export abstract class AggregateRoot<T> extends Entity<T> { | |
// aggregates which implement this must create this method | |
// to consolidate events from the full aggrgate root and children | |
abstract retrieveDomainEvents(): DomainEvent[]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment