Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken committed Jul 3, 2024
1 parent 863b414 commit 29461af
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/MinimalRichDomain/EventSourcedEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected EventSourcedEntity(TId id, IReadOnlyCollection<IDomainEvent> domainEve

private void Rehydrate(IReadOnlyCollection<IDomainEvent> domainEvents)
{
var domainEventsOrderedByVersion = domainEvents.OrderBy(de => de.Version);
var domainEventsOrderedByVersion = domainEvents.OrderBy(de => de.EntityVersion);

foreach (var domainEvent in domainEventsOrderedByVersion)
{
Expand Down Expand Up @@ -54,12 +54,12 @@ protected void ApplyInternal(IDomainEvent domainEvent)
}
}
else
throw new InvalidOperationException($"Cannot apply a domain event with version {domainEvent.Version} while the aggregate is at version {CurrentVersion}. Some aggregate history might be missing.");
throw new InvalidOperationException($"Cannot apply a domain event with version {domainEvent.EntityVersion} while the aggregate is at version {CurrentVersion}. Some aggregate history might be missing.");
}

protected virtual bool CanApply(IDomainEvent @event)
{
return @event.Version == NextVersion;
return @event.EntityVersion == NextVersion;
}

protected abstract void Apply(IDomainEvent @event);
Expand Down
2 changes: 1 addition & 1 deletion src/MinimalRichDomain/IDomainEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace MinimalRichDomain;
public interface IDomainEvent : MinimalDomainEvents.Contract.IDomainEvent
{
int Version { get; }
int EntityVersion { get; }
}
2 changes: 1 addition & 1 deletion src/MinimalRichDomain/MinimalRichDomain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<PackageId>MinimalRichDomain</PackageId>
<Title>Shared kernel for a minimal event-sourced rich domain model</Title>
<Version>1.1.0</Version>
<Version>1.1.1</Version>
<Authors>Ken van Grinsven</Authors>
<Company>Grinsven Software Solutions</Company>
<Product>MinimalRichDomain</Product>
Expand Down
4 changes: 2 additions & 2 deletions test/MinimalRichDomain.Tests/AggregateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public void CanNotApplyEventThatsNotImplemented()
FluentActions.Invoking(action).Should().Throw<InvalidOperationException>().WithMessage("No Apply method has been implemented for type: *.");
}

private sealed record class TestDomainEvent(int Version) : IDomainEvent;
private sealed record class TestDomainEventNotImplemented(int Version) : IDomainEvent;
private sealed record class TestDomainEvent(int EntityVersion) : IDomainEvent;
private sealed record class TestDomainEventNotImplemented(int EntityVersion) : IDomainEvent;

private class TestAggregate : Aggregate<Guid>

Check failure on line 78 in test/MinimalRichDomain.Tests/AggregateTests.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Aggregate<>' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 78 in test/MinimalRichDomain.Tests/AggregateTests.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Aggregate<>' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 78 in test/MinimalRichDomain.Tests/AggregateTests.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Aggregate<>' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 78 in test/MinimalRichDomain.Tests/AggregateTests.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'Aggregate<>' could not be found (are you missing a using directive or an assembly reference?)
{
Expand Down

0 comments on commit 29461af

Please sign in to comment.