Skip to content

Commit fb6ee86

Browse files
breaking-change: remove facts as a concept
you can implement this yourself. entity db will persist your commands!
1 parent 0bef28e commit fb6ee86

File tree

62 files changed

+254
-1399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+254
-1399
lines changed

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ 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 three core sets of data:
28+
There are two core sets of data:
2929

3030
1. Sources
3131
2. Commands
32-
3. Facts
3332

3433
### Sources
3534

@@ -41,15 +40,8 @@ record the headers and connection information of the request.
4140
A command represents the intent to perform some operation on the state. Going back to the bank account example, one
4241
command could be `PerformDeposit` while another could be `PerformWithdrawl`. The things that you can do are commands.
4342

44-
### Facts
45-
46-
A fact is the result of executing a command on the state. In our bank account example, the fact produced
47-
by `PerformDeposit` would be `DepositPerformed`; for `PerformWithdrawl` it would be `WithdrawlPerformed`. However,
48-
commands and facts **DO NOT** need to be one-to-one. A single command can yield as many facts as are needed. You should
49-
keep your facts _bite sized_/_small_.
50-
5143
### Tying it all together
5244

53-
The source, commands, and facts, are all tied together under one transient object - the transaction. A transaction can
45+
The source and commands are all tied together under one transient object - the transaction. A transaction can
5446
have exactly one source and can have many commands; each command can have many facts. When you need to commit your
5547
changes, you commit the transaction - it's all or nothing.
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using EntityDb.Abstractions.Facts;
2-
using System.Collections.Generic;
3-
4-
namespace EntityDb.Abstractions.Commands
1+
namespace EntityDb.Abstractions.Commands
52
{
63
/// <summary>
74
/// Represents the intent to modify a <typeparamref name="TEntity" />.
@@ -10,10 +7,10 @@ namespace EntityDb.Abstractions.Commands
107
public interface ICommand<TEntity>
118
{
129
/// <summary>
13-
/// Returns a new set of modifiers for an entity by this command.
10+
/// Returns a new <typeparamref name="TEntity" /> that incorporates the modification into an entity.
1411
/// </summary>
1512
/// <param name="entity">The entity to be modified.</param>
16-
/// <returns>A new set of modifiers for <paramref name="entity" /> by this command.</returns>
17-
IEnumerable<IFact<TEntity>> Execute(TEntity entity);
13+
/// <returns>A new <typeparamref name="TEntity" /> that incorporates the modification of this command into <paramref name="entity" />.</returns>
14+
TEntity Reduce(TEntity entity);
1815
}
1916
}

src/EntityDb.Abstractions/EntityDb.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<PackageTags>EntityDb EventSourcing DDD CQRS</PackageTags>
3131
<Description>An abstraction layer for the EntityDb suite of packages.</Description>
3232
<PackageIcon>ICON.png</PackageIcon>
33-
<PackageIconUrl/>
33+
<PackageIconUrl />
3434
</PropertyGroup>
3535

3636
<ItemGroup>

src/EntityDb.Abstractions/Facts/IFact.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/EntityDb.Abstractions/Queries/FilterBuilders/IFactFilterBuilder.cs

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/EntityDb.Abstractions/Queries/Filters/IFactFilter.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/EntityDb.Abstractions/Queries/IFactQuery.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/EntityDb.Abstractions/Queries/SortBuilders/IFactSortBuilder.cs

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using EntityDb.Abstractions.Facts;
2-
3-
namespace EntityDb.Abstractions.Strategies
1+
namespace EntityDb.Abstractions.Strategies
42
{
53
/// <summary>
64
/// Represents a type used to manage versioning for a <typeparamref name="TEntity" />.
@@ -14,12 +12,5 @@ public interface IVersioningStrategy<TEntity>
1412
/// <param name="entity">The entity.</param>
1513
/// <returns>The version number of <paramref name="entity" />.</returns>
1614
ulong GetVersionNumber(TEntity entity);
17-
18-
/// <summary>
19-
/// Creates a new version number modifier for an entity.
20-
/// </summary>
21-
/// <param name="versionNumber">The desired version number.</param>
22-
/// <returns>A new version number modifier for on an entity.</returns>
23-
IFact<TEntity> GetVersionNumberFact(ulong versionNumber);
2415
}
2516
}

src/EntityDb.Abstractions/Transactions/ITransaction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace EntityDb.Abstractions.Transactions
55
{
66
/// <summary>
77
/// Represents a set of objects which must be committed together or not at all. Possible objects include: sources,
8-
/// commands, facts, and leases.
8+
/// commands, leases, and tags.
99
/// </summary>
1010
/// <typeparam name="TEntity">The type of entities to be modified.</typeparam>
1111
public interface ITransaction<TEntity>

0 commit comments

Comments
 (0)