Skip to content

Glossary

The top-level entity that defines the consistency boundary in a domain model. External access to internal entities is only allowed through the Aggregate Root. In Functorium, it is implemented as AggregateRoot<TId>.

public class Order : AggregateRoot<OrderId>
{
public void AddItem(Product product, int qty) { /* ... */ }
}

Functorium’s Aggregate Root abstract class. Inherits from Entity<TId> and includes domain event management functionality.

An entity that implements the IAuditable interface. Automatically tracks audit information such as creation time and modification time.


A request that changes the system’s state. Returns no value or only a result. Handles write operations in CQRS.

A principle defined by Bertrand Meyer. Separates methods into Commands (state change, no return) and Queries (no state change, value return).

CQRS (Command Query Responsibility Segregation)

Section titled “CQRS (Command Query Responsibility Segregation)”

A pattern where Greg Young extended CQS to the architecture level. Separates read and write models to optimize each independently.

A type that holds cursor-based pagination results. Includes a cursor value pointing to the next page.

A cursor-based pagination request. Contains the last cursor value from the previous page and the page size. Outperforms the Offset approach on deep pages.


A lightweight ORM (Object-Relational Mapper). Provides object mapping while writing SQL directly. Used for read performance optimization in Query-side adapters.

Functorium’s Dapper-based Query adapter abstract class. Generates SQL to implement IQueryPort.

An immutable object representing a meaningful occurrence in the domain. Implements the IDomainEvent interface.

public record OrderCreatedEvent(OrderId OrderId) : IDomainEvent;

A service that collects and publishes domain events. Publishes events added by Aggregate Roots after transaction commit.

An object for transferring data between layers. In CQRS, the Query side returns DTOs optimized for reads.


Microsoft’s ORM framework. Used for Command-side Repository implementation.

Functorium’s EF Core-based Repository abstract class. Separates domain models from DB models through ToDomain/ToModel conversion methods.

Functorium’s entity abstract class. The base class for domain objects identified by ID.


LanguageExt’s Result type. Represents success(T) or failure(Error). Check state with IsSucc/IsFail.

Functorium’s Usecase return type. Based on Fin<T> and compatible with the Mediator pipeline.

LanguageExt’s monad transformer. Wraps IO<Fin<T>> to support functional composition. The return type of Repository methods.


A LanguageExt function. Fails the FinT pipeline if the condition is not met.

from _ in guard(order.CanCancel(), Error.New("Cannot cancel"))

An interface for tracking audit information (creation time, modification time, etc.).

The request interface for Command Usecases. Inherits from ICommand<FinResponse<TSuccess>>.

The handler interface for Command Usecases. Inherits from ICommandHandler.

The marker interface for domain events.

An interface for collecting and tracking domain events. Collects Aggregate events through the Track method.

An interface for Usecase response caching. Defining CacheKey and Expiration allows UsecaseCachingPipeline to automatically cache responses.

The Entity ID interface. Implemented based on Ulid.

Functorium’s InMemory-based Query adapter abstract class. Used for testing.

Functorium’s InMemory-based Repository abstract class. Stores data in memory using ConcurrentDictionary.

LanguageExt’s pure functional IO effect type. Explicitly represents side effects.

A marker interface for Observability. Uses the RequestCategory property to distinguish Command/Query for metric collection. Both IRepository and IQueryPort inherit from it.

The Query-side adapter interface. Supports Specification-based search, pagination, and streaming.

The request interface for Query Usecases. Inherits from IQuery<FinResponse<TSuccess>>.

The handler interface for Query Usecases. Inherits from IQueryHandler.

The Command-side Repository interface. Defines 8 CRUD methods at the Aggregate Root level.

An interface supporting logical deletion. Sets a deletion flag instead of physically deleting.

The Unit of Work interface. Persists changes with SaveChanges() and starts explicit transactions with BeginTransactionAsync().

The explicit transaction scope interface. Commits with CommitAsync(), and uncommitted transactions are automatically rolled back on Dispose.


A pattern that removes direct dependencies between requests and handlers. Functorium uses the Mediator library to dispatch Commands/Queries.


A type that holds offset-based pagination results. Includes total count, current page, page size, and data list.

An offset-based pagination request. Contains page number and page size.

The Mediator’s request processing pipeline. Handles cross-cutting concerns such as validation, logging, and transactions.


A request that returns data without changing the system’s state. Handles read operations in CQRS.

An implementation of IQueryPort. Includes InMemoryQueryBase, DapperQueryBase, etc.


A pattern that abstracts data access logic. In CQRS, it handles Aggregate Root persistence on the Command side.


A SmartEnum representing sort direction. Has two values: SortDirection.Ascending and SortDirection.Descending.

A type that represents sort criteria. Has a private constructor and is created via factory methods.

  • SortExpression.Empty — No sorting (default)
  • SortExpression.By("Name") — Single field ascending
  • SortExpression.By("Price", SortDirection.Descending) — Single field descending
  • .ThenBy("Name") — Add secondary sort

An abstract class that encapsulates business rules. Uses the IsSatisfiedBy method to determine whether a candidate object satisfies the criteria. Used as search criteria for IQueryPort.

var spec = new ActiveOrderSpec() & new OrderByCustomerSpec(customerId);
var result = await query.Search(spec, page, sort).RunAsync();

The streaming query method of IQueryPort. Returns IAsyncEnumerable<TDto> to process large datasets record by record without loading them entirely into memory.


An extension method that converts Fin<T> to FinResponse<T>. Used for type conversion from the Repository layer to the Usecase layer.

A pipeline that automatically calls SaveChanges and publishes domain events after Command Usecase execution.


Universally Unique Lexicographically Sortable Identifier. Functorium’s Entity IDs are Ulid-based. More sortable than UUID and generated in chronological order.

A pattern that groups multiple Repository operations into a single transaction. Commits all at once with IUnitOfWork.SaveChanges().


A domain object identified by its values rather than an ID. Immutable with equality comparison.


Let’s review the books, online resources, and related libraries for further learning.

-> Appendix F: References