EventSourcedEntity(see below for more information). Entities are always a member of an aggregate.
IAggregateRoot(which itself is also an entity) that provide a public interface for working with the aggregate.
BasicEntitydefine base classes for aggregate roots and entities which will be persisted using their visible state (typically perstisting their public properties) to an RDBMS using an ORM or to a document-oriented database. Alone deriving from these base classes will be enough to be picked-up be Revo's selected persistence implentation (e.g. EF Core).
IQueryableEntitywhich means it will be possible to query them as
IQueryablewith repositories. By default, they will be automatically row-versioned to implement optimistic concurrency when saving them to a database (increasing their version number with each save).
protected; this means it should not limit your from exposing another proper public constructor taking parameters and ensuring entity invariants).
EventSourcedEntitywill use events to progress their state. Unlike the basic entities, they should only modify their state upon emitting a new event. Aggregates can internally publish new events using the
Publish<TEvent>method. This pushes the event to the internal queue of uncommitted events that will get persisted once the repository is saved and invokes an event handler for the specific event type that actually produces the effect of modifying the internal state of the aggregate (e.g. changes the values of its fields). The same event handlers get also invoked when the aggregate gets loaded from a repository.
EventSourcedEntityuse a convention-based event handling by default and will invoke any methods with the following signature:
TEventis the type of the event handled).
DomainAggregateEvent. This domain type includes the aggregate ID which gets automatically injected when publishing the event within an aggregate.
EventSourcedComponent, passing in the event router from the aggregate root (its
EventRouter). The event router takes care of routing the events inside the aggregate, delivering them to all registered components. With that, the event sourced entities and components can use the same
Applymethod convention for handling events as with aggregate root and use the event router for publishing new events.
ValueObject<T>abstract base class that implements basic value-like semantics. An example follows.
Tbeing a self-reference to the value object type implemented) overrides
ToStringmethods making it possible to treat the instances of the object as a single value - e.g. they can be correctly used in HashSets, as Dictionary keys, compared between each other, etc. (with objects having the same values considered to be equal, very much unlike with the default behavior of C# classes which considered references only), e.g.:
GetValueComponentsmethod as shown previously.
CollectionAsValueExtensionsimplements the following extension methods (abridged code snippet):
GetValueComponentsmethod to wrap lists, arrays, sets and dictionaries with correct value-object-like semantics.