Skip to content

Commit

Permalink
Fixes #124 (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev authored Aug 25, 2022
1 parent da628a3 commit 7bb546a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Core/src/Eventuous/Aggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public abstract class Aggregate {
/// </summary>
/// <exception cref="DomainException"></exception>
protected void EnsureDoesntExist(Func<Exception>? getException = null) {
if (Original.Length > 0)
if (CurrentVersion >= 0)
throw getException?.Invoke()
?? new DomainException($"{GetType().Name} already exists");
}
Expand All @@ -66,7 +66,7 @@ protected void EnsureDoesntExist(Func<Exception>? getException = null) {
/// </summary>
/// <exception cref="DomainException"></exception>
protected void EnsureExists(Func<Exception>? getException = null) {
if (Original.Length == 0)
if (CurrentVersion < 0)
throw getException?.Invoke()
?? new DomainException($"{GetType().Name} doesn't exist");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Confluent.Kafka;
using Eventuous.Producers;
using Eventuous.Producers.Diagnostics;
using Microsoft.Extensions.Hosting;

namespace Eventuous.Kafka.Producers;

Expand Down

0 comments on commit 7bb546a

Please sign in to comment.