Skip to content

Commit fd16d30

Browse files
committed
moreof
1 parent 652e5bf commit fd16d30

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

equinox-web-csharp/Domain/Aggregate.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,15 @@ public static State Fold(State origin, IEnumerable<Event> xs)
6464
}
6565

6666
/// Defines the decision process which maps from the intent of the `Command` to the `Event`s that represent that decision in the Stream
67-
public abstract class Command
67+
public abstract class Command : OneOfBase<Command.MakeItSo>
6868
{
6969
public class MakeItSo : Command
7070
{
7171
}
7272

73-
public static IEnumerable<Event> Interpret(State s, Command x)
74-
{
75-
switch (x)
76-
{
77-
case MakeItSo c:
78-
if (!s.Happened) yield return new Event.Happened();
79-
break;
80-
default: throw new ArgumentOutOfRangeException(nameof(x), x, "invalid");
81-
}
82-
}
73+
public static Event[] Interpret(State s, Command x) =>
74+
x.Match(makeItSo =>
75+
s.Happened ? new Event[0] : new Event [] { new Event.Happened()});
8376
}
8477

8578
class Handler

equinox-web-csharp/Domain/Domain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0</TargetFrameworks>
5-
<LangVersion>7.3</LangVersion>
5+
<LangVersion>7</LangVersion>
66
</PropertyGroup>
77

88
<ItemGroup>

equinox-web-csharp/Web/Startup.cs

100755100644
File mode changed.

0 commit comments

Comments
 (0)