Skip to content

Commit

Permalink
Merge pull request #63 from NerosoftDev/develop
Browse files Browse the repository at this point in the history
Fixes bugs.
  • Loading branch information
Codespilot authored Dec 15, 2023
2 parents e376e36 + 247ac7f commit 3c55901
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Source/Euonia.Domain/Aggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ protected void Register<T>(Action<T> when)
public virtual void RaiseEvent<TEvent>(TEvent @event)
where TEvent : DomainEvent
{
_handlers[typeof(TEvent)](@event);
if (_handlers.TryGetValue(typeof(TEvent), out var handler))
{
handler(@event);
}
_events.Add(@event);
}

Expand All @@ -45,7 +48,10 @@ public virtual void RaiseEvent<TEvent>(TEvent @event)
public void Apply<TEvent>(TEvent @event)
where TEvent : DomainEvent
{
_handlers[typeof(TEvent)](@event);
if (_handlers.TryGetValue(typeof(TEvent), out var handler))
{
handler(@event);
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion project.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>8.1.12</Version>
<Version>8.1.13</Version>
<Authors>damon</Authors>
<Company>Nerosoft Ltd.</Company>
<Product>Euonia</Product>
Expand Down

0 comments on commit 3c55901

Please sign in to comment.