Skip to content

Commit e75f8b9

Browse files
Update README.md
1 parent cd1f698 commit e75f8b9

File tree

1 file changed

+49
-14
lines changed

1 file changed

+49
-14
lines changed

README.md

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,28 @@ information on the statement. (If I'm wrong, you should consider getting a new b
2525

2626
## How does EntityDb.NET implement Event Sourcing?
2727

28-
There are five core objects at the heart of this implementation
29-
30-
1. Transactions
31-
2. Agent
32-
3. Commands
33-
4. Tags
34-
5. Leases
28+
There are several core objects at the heart of this implementation. Encalsulating these objects are various repositories.
29+
30+
1. Transaction Repository
31+
- Agents
32+
- Commands
33+
- Tags
34+
- Leases
35+
2. Snapshot Repository
36+
- Snapshots
37+
2. Entity Repository
38+
- Transaction Repository
39+
- Optional: Snapshot Repository
40+
3. Projection Repository
41+
- Transaction Repository
42+
- Optional: Snapshot Repository
3543

3644
### Transactions
3745

38-
A transaction represents an atomic operation on multiple entities. A transaction is ideally* committed atomically or not
46+
A transaction represents an atomic operation on multiple entities. A transaction is committed atomically or not
3947
at all. If some step in the transaction fails, the entire transaction should fail.
4048

41-
*In the MongoDb implementation, the transaction _is_ committed atomically. However, it is possible in the future that
42-
there will be implementations that are not capable of doing this if you want to use tags and/or leases. An example would
43-
be EventStore, which provides no ability to enforce uniqueness constraints in its transaction. Such implementations will
44-
need a complimentary transaction in order to make use of tags and leases.
45-
46-
### Agent
49+
### Agents
4750

4851
An agent is an actor that can execute transactions. For example, if a transaction is initiated via an HTTP API, you
4952
might use the `HttpContextAgent` - it's signature includes headers and connection information, and it uses the
@@ -73,3 +76,35 @@ and the `Value` is whatever username the member wants to use. If an attempt to c
7376
violate the uniqueness constraint, it will be rejected. (This is obnoxious behavior for the user, though, so the bank
7477
should check before attempting to commit to see if the username is available and give immediate feedback to choose a
7578
different username).
79+
80+
### Snapshots
81+
82+
A snapshot is a stateful object at a given point in time. They always have an identifier and a version number.
83+
Together, the identifier and version number called a pointer. You can request different versions of a given snapshot
84+
by using different pointers!
85+
86+
In the context of snapshots, the reserved version number is reserved for pointing to the latest snapshot.
87+
So if you want the latest version, you use a pointer with the exact id and the reserved version number.
88+
If you want a specific version, you can create pointer with the exact id and version number you want.
89+
90+
The balance on your bank account is a snapshot. You can build that snapshot by summing all of the deposits and
91+
withdrawls on your account. If you look at the bank statements, you will most likely see the snapshot of each bank
92+
account for that statement, along with all of the deposits, withdrawls, and interest.
93+
94+
### Entities
95+
96+
An entity is conceptually an aggregate root inside of a bounded context, and it extends the concept of a snapshot.
97+
In the banking example, there are multiple entities. You have a membership at the bank. That's an entity. You probably
98+
have a checking account. That's an entity. And you might even have a savings account. That is also an entity!
99+
100+
Which bounded contexts these entiies live in is up to the business.
101+
102+
### Projections
103+
104+
A projection is an aggregate, but notably _not_ the aggregate root, and it too extends the concept of a snapshot.
105+
In the banking example, one example of a projection could be your entire account balance. It can be anything, though!
106+
You are not constrained in what data you want to use for your projection.
107+
108+
### Notifications
109+
110+
- Coming Soon!

0 commit comments

Comments
 (0)