Event Sourcing - storing the history, not just the state
Event Sourcing explained through state versus event history, commands, aggregates, append-only stores, projections, snapshots and versioned events for practical guidance.
Event Sourcing - storing the history, not just the state
A current value is useful for answering what is true now, but it is not always answering how we arrived there. Fund prices, unit corrections and document approvals can require an audit trail. In the previous article, we discussed portable .NET processes and repeatable operations with the Twelve-Factor principles. In this article, we are going to compare state-only persistence with Event Sourcing and see the trade-off of storing business history as events.
TL;DR Summary
- State-only storage keeps the current answer and is often the simplest default.
- Event Sourcing stores the sequence of accepted events as the source of truth.
- An aggregate validates commands and produces events.
- A projection builds a read model from the event stream.
- Events should describe facts and should not be edited like current state.
- Snapshots reduce replay time but are derived optimisation data.
- Event Sourcing helps audit and temporal questions, but adds replay and schema complexity.
Challenges
Current state loses the story
A SQL row can say that Fund 123 has price 10.50, but it cannot by itself explain whether the price was corrected from 10.20, imported twice or approved by an operator. Audit columns help, but they are not always the complete business history.
History is not free
Event Sourcing creates a durable event stream and a projection process. Every event needs a contract, version strategy, retention choice and replay test. A team which only wants an audit column may be taking on more machinery than the problem requires.
Read models can be behind
The event is accepted before the projection is complete, so a query can briefly show old data. The UI and support process must understand this eventual consistency. Projection failures must be visible and replayable.
What is Event Sourcing?
Event Sourcing is a persistence approach where the sequence of domain events is the source of truth and current state is derived by replaying those events.
In simple terms, instead of storing only Fund 123: Price 10.50, we store FundCreated, PriceUpdated 10.20 and PriceUpdated 10.50. The current price is calculated from the history.
An everyday analogy is a bank statement. The current balance is useful, but the statement is showing deposits, withdrawals and corrections which explain how the balance was reached. A snapshot is like the balance printed on the first page; the transactions are still the evidence.
Why Event Sourcing is important?
Event Sourcing is important when the business needs auditability, temporal reconstruction or multiple read models from the same facts. It is not automatically better than a relational row. The team must be able to version events, rebuild projections and answer operational questions without replaying an unmanageable stream for every query.
The following diagram compares current state with events:

The State only panel contains one current price. The Event Sourcing panel contains FundCreated, PriceUpdated 10.20 and PriceUpdated 10.50. The sequence is preserving the reason for the current value.
Commands, aggregates and events
A command is a request, not a fact. The aggregate is validating the command against current state and producing an event:
public sealed class UpdateFundPrice
{
public int FundId { get; set; }
public decimal Value { get; set; }
}
public sealed class PriceUpdated
{
public int FundId { get; set; }
public decimal Value { get; set; }
public DateTime RecordedAtUtc { get; set; }
}
public IEnumerable<object> Handle(UpdateFundPrice command)
{
if (command.Value <= 0)
throw new InvalidOperationException("Price must be positive.");
yield return new PriceUpdated
{
FundId = command.FundId,
Value = command.Value,
RecordedAtUtc = DateTime.UtcNow
};
}
The append-only event store is writing the event with an aggregate id and version:
eventStore.Append(
aggregateId: "fund-123",
expectedVersion: 7,
events: new[] { priceUpdated });
The expected version is preventing two writers from silently overwriting each other. Events are not being updated after publication. A correction is another event, such as PriceCorrected, with the reason and source.
Projections and snapshots
The following diagram depicts Command → Aggregate → Event Store (append only) → Projection → Read model (SQL) → Query:

The purple path is the command-to-event-store path, because accepted events are the source of truth. The SQL read model is derived and can be rebuilt. The projection is applying events:
public async Task Apply(PriceUpdated e)
{
await sql.ExecuteAsync(
"UPDATE FundReadModel SET Price = @Value, " +
"PriceDate = @RecordedAtUtc WHERE FundId = @FundId",
e);
}
When a stream has thousands of events, a snapshot can store the aggregate state at version 500. Replay starts from that snapshot and applies events 501 onwards. The snapshot is not replacing the event store; it is an optimisation which can be discarded and rebuilt.
Event versioning
An event contract is consumed by old projections and new projections. Renaming Value to Price without a compatibility strategy can break replay. Upcasters or explicit event versions are useful:
PriceUpdatedV1 -> PriceUpdatedV2
The design is keeping the original event and translating it during replay. This is important when an audit record must remain trustworthy.
Trade-offs
| Approach | Pros | Cons |
|---|---|---|
| State only | + Simple reads and updates<br>+ Familiar SQL operations | − Business history can be lost<br>− Past state is difficult to reconstruct |
| Event Sourcing | + Complete event history and replay<br>+ Multiple projections from facts | − Event versioning and replay are complex<br>− Read models are eventually consistent |
In our case, we are using state-only persistence for ordinary CRUD and considering Event Sourcing for a pricing or approval domain where the history is a business requirement. We are not adopting it for every table. It is mandatory to define projection recovery before the first event is published.
Replay, privacy and operational cost
Replay is treated as a production capability. A projection is rebuilt in an isolated database first, and the record count, latest price and checksum are compared with the current read model. Only after the comparison is approved is the projection switched to serve queries. This prevents a replay defect from replacing the live view silently.
Event data can contain personal or commercially sensitive values. The event schema is therefore storing the minimum needed to explain the business fact. A customer address does not belong in every historical price event, and a redaction requirement must be considered before publication because an append-only store is intentionally difficult to edit.
Snapshots are taken at a known aggregate version. When a Fund stream reaches version 1,000, a snapshot can store its state at version 900 and replay the remaining events. If the snapshot is corrupt, it is discarded and rebuilt from the event stream. The event store remains the authority.
The team is also deciding how long events and projections are retained, how a new event version is introduced and how a failed projection is alerted. Without these decisions, Event Sourcing is only moving complexity from the database schema into an operational process.
The read model is designed for its query, not for every event field. A fund list can store the current price and name, while an audit screen can store the event id, actor and reason. Two projections can therefore evolve independently without changing the event stream. A query does not replay the complete history during every browser request.
Commands are rejected when the aggregate version is stale. If two operators correct Fund 123 at once, the second command loads the new version and decides again. This protects the event order and makes the conflict visible. An automatic “last write wins” rule would be dangerous for a price correction.
The event store also requires backup and access control. A history which can be changed by every application identity is not a trustworthy audit trail. The append operation is restricted, while projections receive read access and cannot modify old events.
The product owner is deciding which historical questions are valuable. “What was the price at the end of June?” and “who approved the correction?” are useful questions; replaying every technical notification is not automatically useful. This decision is keeping the event model focused on business facts.
Must Do and Don’ts
- Must Do: Validate commands inside the aggregate, otherwise invalid fund prices will enter the event stream.
- Must Do: Append with an expected version, because concurrent writers must not overwrite an event history silently.
- Must Do: Keep projections rebuildable and monitor their lag, so a read model failure can be repaired.
- Must Do: Version event contracts, otherwise a later code change can make old events unreadable.
- Don’t: edit a published event to correct history, because an audit trail must preserve what happened.
- Don’t: choose Event Sourcing only to avoid designing a normal table, otherwise replay complexity adds without business value.
Wrap up
In this article, we have looked at current state, event history, commands, aggregates, append-only stores, projections, snapshots and versioned events. Event Sourcing is useful when history is a business capability, not merely a technical preference. I hope this article provided you some insights into when it is worth the cost. In the next article, I will walk you through front-end architecture and Angular 2 versus React for enterprise applications.
Related Posts
Monolith vs Microservices - should we start with microservices?
Monoliths and microservices compared through modular boundaries, extraction signals, scaling, team ownership, distributed failure, and practical starting criteria for growing teams.
What is CQRS - separating reads and writes, and when not to use it?
CQRS explained through commands, handlers, queries, read models, eventual consistency, and the situations where separating reads and writes is unnecessary.
Microservices - Part 1
Microservices Part 1 explains Conway's Law, modular monoliths, service ownership, distributed data, deployment independence and the hidden costs of service boundaries.