Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sample 2 and Sample 3 #432

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,5 @@ MigrationBackup/
FodyWeavers.xsd

**/.idea/

.DS_Store
Binary file removed Samples/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>c94946b2-509e-4fea-a5bf-ac97e8eefb44</UserSecretsId>
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
<PackageReference Include="Sekiban.Infrastructure.Cosmos" Version="0.20.3" />
<PackageReference Include="Sekiban.Web" Version="0.20.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
<PackageReference Include="Sekiban.Infrastructure.Cosmos" Version="0.22.0-preview9" />
<PackageReference Include="Sekiban.Web" Version="0.22.0-preview9" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ public record ChangeUserPointName(
[property: Required]
string NameToChange) : ICommandWithHandler<UserPoint, ChangeUserPointName>
{
// Aggregate Id should be current aggregate.
public Guid GetAggregateId() => UserPointId;
public static ResultBox<UnitValue> HandleCommand(
ChangeUserPointName command,
ICommandContext<UserPoint> context) =>
ResultBox.Start
.Verify(
_ => context.GetState().Payload.Name == command.NameToChange
? new InvalidOperationException("Already have same name as requested.")
: ExceptionOrNone.None)
.Conveyor(_ => context.AppendEvent(new UserPointNameChanged(command.NameToChange)));
public static Guid SpecifyAggregateId(ChangeUserPointName command) => command.UserPointId;
public static ResultBox<EventOrNone<UserPoint>> HandleCommand(ChangeUserPointName command, ICommandContext<UserPoint> context) =>
ResultBox.Start
.Verify(
_ => context.GetState().Payload.Name == command.NameToChange
? new InvalidOperationException("Already have same name as requested.")
: ExceptionOrNone.None)
.Conveyor(_ => EventOrNone.Event(new UserPointNameChanged(command.NameToChange)));
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ public record CreateUserPoint(
int Point) : ICommandWithHandler<UserPoint, CreateUserPoint>
{
// Assign new Aggregate Id by NewGuid()
public Guid GetAggregateId() => Guid.NewGuid();
public static Guid SpecifyAggregateId(CreateUserPoint command) => Guid.NewGuid();

public static ResultBox<UnitValue> HandleCommand(
CreateUserPoint command,
ICommandContext<UserPoint> context) =>
context.AppendEvent(new UserPointCreated(command.Name, command.Email, command.Point));
public static ResultBox<EventOrNone<UserPoint>> HandleCommand(CreateUserPoint command, ICommandContext<UserPoint> context)
=> context.AppendEvent(new UserPointCreated(command.Name, command.Email, command.Point));
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Sekiban.Core" Version="0.20.3" />
<PackageReference Include="Sekiban.Core" Version="0.22.0-preview9" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="Sekiban.Testing" Version="0.20.3" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
<PackageReference Include="Sekiban.Testing" Version="0.22.0-preview9" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Loading
Loading