ensureDoesntExists method

  1. @protected
void ensureDoesntExists()

Subclasses of Aggregate should use this method to ensure that is is operating on a new Aggregate.

Implementation

@protected
void ensureDoesntExists() {
  if (currentVersion > -1) {
    throw AggregateExistsException(runtimeType, id);
  }
}