From cb9881a9524205930edd8f7b410609423528abf3 Mon Sep 17 00:00:00 2001 From: Tomohisa Takaoka Date: Thu, 14 Nov 2024 13:28:05 -0800 Subject: [PATCH 1/4] sample 2 fixed --- .DS_Store | Bin 6148 -> 0 bytes Samples/.DS_Store | Bin 6148 -> 0 bytes ...kibanEventSourcingBasics.Cosmos.Web.csproj | 11 +- .../Commands/ChangeUserPointName.cs | 19 +- .../UserPoints/Commands/CreateUserPoint.cs | 8 +- .../SekibanEventSourcingBasics.Domain.csproj | 4 +- .../SekibanEventSourcingBasics.Testing.csproj | 9 +- ...SekibanEventSourcingBasics.sln.DotSettings | 327 +++++++++++++++++- 8 files changed, 350 insertions(+), 28 deletions(-) delete mode 100644 .DS_Store delete mode 100644 Samples/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5b549d5722c57e5d6c5330301fdbc0aca50f0cca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T3QwBov_sMUMfm1zSr+@DgHu0V8@)sR=C_OtYm)?V%KM)fe(jd>&_Z zH()j3O~lT??l(I>yO|HNKL8;7*{}o91OOWwp&+F~$Xw~#Fu{aE&5^(evS^-7qNHM? zzi6Uww;+HJ#xQ|T-!CKdyhW2F&hmEqU2N3qn_HIUSPkngc$D)X5A#{(htnGxT}qim zr5;9C@n}A1?wrXq594$+RSEHMgdw-raXOT9U(V8Drg8)Aa2(qiH1`&ZcFR5KEnDv5 zsCSHdr`v5WmyW%AaCmw#cuK~pe9=q_Bwfk2!4h6k`BKz#FijJgKA@+}Dx(>h0cL<1 zU%)lxGH9c(7`G1bT zOywhgHHAma05kB<7!dV-(D$(@bGCjfkIq^b+dVcCiYrJ#L4D;CfCJh`_LWonUD7em YGgxS(S;(%^5&0sZ2;q(y_yq<&05cR!CIA2c diff --git a/Samples/.DS_Store b/Samples/.DS_Store deleted file mode 100644 index c1e57eada4dfb09dae83b7f69ea80e622e7554e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ5EC}5S)b+L1|J_`U>2@ioyxV0r;drdeV~!>0gy|aWrN>1<`{pG|{ZI9(%oG z%Tv643&1wV{R6NDu%tWU=!O zypH4G+cGI21*Cu!kOETRf(le|U9K*8rjC*VQs6oi@b5#TJNCjUF+Lp}q6Hu>7!Kn+ zdI@6l0I?TNiHy)Jsl=pOwHTIk##`m}!YMK7uxdW6Zno-BENN(xAUt5U!g+o$b@PpaBFdz{zWMt`Pz&KKQ{^Pq5ua!ibJ%!QZZ d`$)>X=5y}%!YMK6j0c^lp8?lJCI$Xmfp3=!6{7$E diff --git a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Cosmos.Web/SekibanEventSourcingBasics.Cosmos.Web.csproj b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Cosmos.Web/SekibanEventSourcingBasics.Cosmos.Web.csproj index 340a0ea47..df6ef3104 100644 --- a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Cosmos.Web/SekibanEventSourcingBasics.Cosmos.Web.csproj +++ b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Cosmos.Web/SekibanEventSourcingBasics.Cosmos.Web.csproj @@ -1,17 +1,18 @@  - net8.0 + net9.0 enable enable c94946b2-509e-4fea-a5bf-ac97e8eefb44 + preview - - - - + + + + diff --git a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/ChangeUserPointName.cs b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/ChangeUserPointName.cs index 639412321..3bbd0cbb9 100644 --- a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/ChangeUserPointName.cs +++ b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/ChangeUserPointName.cs @@ -10,15 +10,12 @@ public record ChangeUserPointName( [property: Required] string NameToChange) : ICommandWithHandler { - // Aggregate Id should be current aggregate. - public Guid GetAggregateId() => UserPointId; - public static ResultBox HandleCommand( - ChangeUserPointName command, - ICommandContext 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> HandleCommand(ChangeUserPointName command, ICommandContext 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))); } diff --git a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/CreateUserPoint.cs b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/CreateUserPoint.cs index c30c3efd7..4fa1ee6bf 100644 --- a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/CreateUserPoint.cs +++ b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/Aggregates/UserPoints/Commands/CreateUserPoint.cs @@ -14,10 +14,8 @@ public record CreateUserPoint( int Point) : ICommandWithHandler { // Assign new Aggregate Id by NewGuid() - public Guid GetAggregateId() => Guid.NewGuid(); + public static Guid SpecifyAggregateId(CreateUserPoint command) => Guid.NewGuid(); - public static ResultBox HandleCommand( - CreateUserPoint command, - ICommandContext context) => - context.AppendEvent(new UserPointCreated(command.Name, command.Email, command.Point)); + public static ResultBox> HandleCommand(CreateUserPoint command, ICommandContext context) + => context.AppendEvent(new UserPointCreated(command.Name, command.Email, command.Point)); } diff --git a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/SekibanEventSourcingBasics.Domain.csproj b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/SekibanEventSourcingBasics.Domain.csproj index ff7cffcb1..1c0b19f4a 100644 --- a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/SekibanEventSourcingBasics.Domain.csproj +++ b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Domain/SekibanEventSourcingBasics.Domain.csproj @@ -1,13 +1,13 @@  - net8.0 enable enable + net8.0;net9.0 - + diff --git a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Testing/SekibanEventSourcingBasics.Testing.csproj b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Testing/SekibanEventSourcingBasics.Testing.csproj index f8c4c2668..36ca35b9a 100644 --- a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Testing/SekibanEventSourcingBasics.Testing.csproj +++ b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.Testing/SekibanEventSourcingBasics.Testing.csproj @@ -1,18 +1,19 @@ - net8.0 + net9.0 enable enable false true + preview - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.sln.DotSettings b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.sln.DotSettings index 22aabed3b..adb6ee2f2 100644 --- a/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.sln.DotSettings +++ b/Samples/Tutorials/2.SekibanEventSourcingBasics/SekibanEventSourcingBasics.sln.DotSettings @@ -1,2 +1,327 @@  - True \ No newline at end of file + HINT + HINT + HINT + True + Required + NotRequired + Required + False + ExpressionBody + ExpressionBody + ExpressionBody + public protected private virtual file override internal static sealed readonly async abstract extern unsafe volatile new required + Remove + 0 + True + False + False + True + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 100 + 100 + True + True + True + True + True + False + True + 4 + 5 + 4 + COMPACT + False + NEVER + True + False + ALWAYS + ALWAYS + NEVER + True + True + False + NEVER + False + True + True + False + False + True + True + True + True + CHOP_IF_LONG + CHOP_IF_LONG + True + True + CHOP_IF_LONG + CHOP_IF_LONG + CHOP_IF_LONG + WRAP_IF_LONG + CHOP_IF_LONG + 120 + CHOP_ALWAYS + CHOP_IF_LONG + CHOP_ALWAYS + CHOP_IF_LONG + <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern DisplayName="Non-reorderable types"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + <HasAttribute Name="JetBrains.Annotations.NoReorderAttribute" /> + <HasAttribute Name="JetBrains.Annotations.NoReorder" /> + </Or> + </TypePattern.Match> + </TypePattern> + + <TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="True" /> + <HasAttribute Name="Xunit.TheoryAttribute" Inherited="True" /> + </And> + </HasMember> + </And> + </TypePattern.Match> + + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <Or> + <Kind Is="Constructor" /> + <And> + <Kind Is="Method" /> + <ImplementsInterface Name="System.IDisposable" /> + </And> + </Or> + </Entry.Match> + + <Entry.SortBy> + <Kind> + <Kind.Order> + <DeclarationKind>Constructor</DeclarationKind> + </Kind.Order> + </Kind> + </Entry.SortBy> + </Entry> + + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="false" /> + <HasAttribute Name="Xunit.TheoryAttribute" Inherited="false" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + + <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <Or> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureSourceAttribute" Inherited="true" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" /> + </And> + </HasMember> + </Or> + </And> + </TypePattern.Match> + + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureSetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureTearDownAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.OneTimeSetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.OneTimeTearDownAttribute" Inherited="true" /> + </Or> + </And> + </Entry.Match> + </Entry> + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + + <TypePattern DisplayName="Default Pattern"> + <Entry DisplayName="Public Delegates" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Delegate" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Public Enums" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Static Fields and Constants"> + <Entry.Match> + <Or> + <Kind Is="Constant" /> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Or> + </Entry.Match> + + <Entry.SortBy> + <Kind> + <Kind.Order> + <DeclarationKind>Constant</DeclarationKind> + <DeclarationKind>Field</DeclarationKind> + </Kind.Order> + </Kind> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Fields"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + </And> + </Entry.Match> + + <Entry.SortBy> + <Readonly /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Properties, Indexers"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + </Or> + </Entry.Match> + </Entry> + <Entry DisplayName="Constructors"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + + <Entry.SortBy> + <Static/> + </Entry.SortBy> + </Entry> + + + + <Entry DisplayName="Interface Implementations" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Member" /> + <ImplementsInterface /> + </And> + </Entry.Match> + + <Entry.SortBy> + <ImplementsInterface Immediate="true" /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Nested Types"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + </Entry> + </TypePattern> +</Patterns> + + False + <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></Policy> + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file From 56b1007950c710ba129150285565b58738a2703c Mon Sep 17 00:00:00 2001 From: Tomohisa Takaoka Date: Thu, 14 Nov 2024 13:30:07 -0800 Subject: [PATCH 2/4] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b1abf55e5..a912ba085 100644 --- a/.gitignore +++ b/.gitignore @@ -362,3 +362,5 @@ MigrationBackup/ FodyWeavers.xsd **/.idea/ + +.DS_Store \ No newline at end of file From 6a451bcb5f4ba89fd0e37713565192ea6743a3a5 Mon Sep 17 00:00:00 2001 From: Tomohisa Takaoka Date: Thu, 14 Nov 2024 13:32:14 -0800 Subject: [PATCH 3/4] improve .gitignore to avoid .DS_Store --- docs/docfx_project/.gitignore | 4 +++- docs/docfx_project/api/.gitignore | 2 ++ src/.gitignore | 2 ++ src/Sekiban.Testing/.gitignore | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/docfx_project/.gitignore b/docs/docfx_project/.gitignore index 9a4461a5a..556179300 100644 --- a/docs/docfx_project/.gitignore +++ b/docs/docfx_project/.gitignore @@ -7,4 +7,6 @@ /**/bin/ /**/obj/ -_site \ No newline at end of file +_site + +.DS_Store \ No newline at end of file diff --git a/docs/docfx_project/api/.gitignore b/docs/docfx_project/api/.gitignore index e8079a3be..edb5e0a84 100644 --- a/docs/docfx_project/api/.gitignore +++ b/docs/docfx_project/api/.gitignore @@ -3,3 +3,5 @@ ############### *.yml .manifest + +.DS_Store \ No newline at end of file diff --git a/src/.gitignore b/src/.gitignore index 46d84a96a..ccb58969a 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -360,3 +360,5 @@ MigrationBackup/ # Fody - auto-generated XML schema FodyWeavers.xsd + +.DS_Store \ No newline at end of file diff --git a/src/Sekiban.Testing/.gitignore b/src/Sekiban.Testing/.gitignore index ff5b00c50..3f41f0e68 100644 --- a/src/Sekiban.Testing/.gitignore +++ b/src/Sekiban.Testing/.gitignore @@ -261,4 +261,6 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc + +.DS_Store \ No newline at end of file From f969cd853b70724d96cb35945ddd9bd320d643c2 Mon Sep 17 00:00:00 2001 From: Tomohisa Takaoka Date: Thu, 14 Nov 2024 14:05:30 -0800 Subject: [PATCH 4/4] Updated Sample 3 --- .../Postgres.Sample.Domain.Test.csproj | 8 +- .../Aggregates/Players/RegisterPlayer.cs | 16 +- .../Aggregates/Teams/RegisterTeam.cs | 7 +- .../Aggregates/Teams/Team.cs | 18 +- .../Postgres.Sample.Domain.csproj | 4 +- .../Postgres.Sample.sln.DotSettings | 327 ++++++++++++++++++ .../Postgres.Sample/Postgres.Sample.csproj | 8 +- 7 files changed, 364 insertions(+), 24 deletions(-) create mode 100644 Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.sln.DotSettings diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain.Test/Postgres.Sample.Domain.Test.csproj b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain.Test/Postgres.Sample.Domain.Test.csproj index 8138ee290..7db2c9031 100644 --- a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain.Test/Postgres.Sample.Domain.Test.csproj +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain.Test/Postgres.Sample.Domain.Test.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable @@ -14,9 +14,9 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Players/RegisterPlayer.cs b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Players/RegisterPlayer.cs index ac1793a97..10f756f9f 100644 --- a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Players/RegisterPlayer.cs +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Players/RegisterPlayer.cs @@ -1,13 +1,17 @@ +using Postgres.Sample.Domain.Aggregates.Teams; using ResultBoxes; using Sekiban.Core.Command; namespace Postgres.Sample.Domain.Aggregates.Players; -public record RegisterPlayer(string Name, Guid TeamId) - : ICommandWithHandlerForExistingAggregate +public record RegisterPlayer(string Name, Guid TeamId) : ICommandWithHandlerAsync { - public Guid GetAggregateId() => Guid.NewGuid(); - public static ResultBox HandleCommand( + public static Guid SpecifyAggregateId(RegisterPlayer command) => Guid.CreateVersion7(); + public static Task>> HandleCommandAsync( RegisterPlayer command, - ICommandContext context) => context.AppendEvent(new PlayerRegistered(command.Name)) - .Conveyor(_ => context.AppendEvent(new PlayerRegisteredToTeam(command.TeamId))); + ICommandContext context) => + context + .ExecuteQueryAsync(new ExistsTeam(command.TeamId)) + .Verify(exits => exits ? ExceptionOrNone.None : new ApplicationException("Team not exists")) + .Conveyor(_ => context.AppendEvent(new PlayerRegistered(command.Name))) + .Conveyor(_ => context.AppendEvent(new PlayerRegisteredToTeam(command.TeamId))); } diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/RegisterTeam.cs b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/RegisterTeam.cs index 10c504ae8..786713ddd 100644 --- a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/RegisterTeam.cs +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/RegisterTeam.cs @@ -4,8 +4,7 @@ namespace Postgres.Sample.Domain.Aggregates.Teams; public record RegisterTeam(string Name) : ICommandWithHandler { - public Guid GetAggregateId() => Guid.NewGuid(); - public static ResultBox HandleCommand( - RegisterTeam command, - ICommandContext context) => context.AppendEvent(new TeamRegistered(command.Name)); + public static Guid SpecifyAggregateId(RegisterTeam command) => Guid.CreateVersion7(); + public static ResultBox> HandleCommand(RegisterTeam command, ICommandContext context) => + context.AppendEvent(new TeamRegistered(command.Name)); } diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/Team.cs b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/Team.cs index b155f57a5..c0f56f969 100644 --- a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/Team.cs +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Aggregates/Teams/Team.cs @@ -2,6 +2,7 @@ using Sekiban.Core.Aggregate; using Sekiban.Core.Command; using Sekiban.Core.Events; +using Sekiban.Core.Query.QueryModel; namespace Postgres.Sample.Domain.Aggregates.Teams; public record Team(string Name) : IAggregatePayload @@ -16,8 +17,17 @@ public static Team OnEvent(Team aggregatePayload, Event ev) => } public record ChangeTeamName(Guid TeamId, string Name) : ICommandWithHandler { - public Guid GetAggregateId() => TeamId; - public static ResultBox HandleCommand( - ChangeTeamName command, - ICommandContext context) => context.AppendEvent(new TeamNameChanged(command.Name)); + public static Guid SpecifyAggregateId(ChangeTeamName command) => command.TeamId; + + public static ResultBox> HandleCommand(ChangeTeamName command, ICommandContext context) => + context.AppendEvent(new TeamNameChanged(command.Name)); +} +public record ExistsTeam(Guid TeamId) : INextAggregateQuery +{ + + public static ResultBox HandleFilter( + IEnumerable> list, + ExistsTeam query, + IQueryContext context) => + list.Any(x => x.AggregateId == query.TeamId); } diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Postgres.Sample.Domain.csproj b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Postgres.Sample.Domain.csproj index ff7cffcb1..f5ff11d9b 100644 --- a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Postgres.Sample.Domain.csproj +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.Domain/Postgres.Sample.Domain.csproj @@ -1,13 +1,13 @@  - net8.0 enable enable + net9.0 - + diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.sln.DotSettings b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.sln.DotSettings new file mode 100644 index 000000000..adb6ee2f2 --- /dev/null +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample.sln.DotSettings @@ -0,0 +1,327 @@ + + HINT + HINT + HINT + True + Required + NotRequired + Required + False + ExpressionBody + ExpressionBody + ExpressionBody + public protected private virtual file override internal static sealed readonly async abstract extern unsafe volatile new required + Remove + 0 + True + False + False + True + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 100 + 100 + True + True + True + True + True + False + True + 4 + 5 + 4 + COMPACT + False + NEVER + True + False + ALWAYS + ALWAYS + NEVER + True + True + False + NEVER + False + True + True + False + False + True + True + True + True + CHOP_IF_LONG + CHOP_IF_LONG + True + True + CHOP_IF_LONG + CHOP_IF_LONG + CHOP_IF_LONG + WRAP_IF_LONG + CHOP_IF_LONG + 120 + CHOP_ALWAYS + CHOP_IF_LONG + CHOP_ALWAYS + CHOP_IF_LONG + <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern DisplayName="Non-reorderable types"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + <HasAttribute Name="JetBrains.Annotations.NoReorderAttribute" /> + <HasAttribute Name="JetBrains.Annotations.NoReorder" /> + </Or> + </TypePattern.Match> + </TypePattern> + + <TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="True" /> + <HasAttribute Name="Xunit.TheoryAttribute" Inherited="True" /> + </And> + </HasMember> + </And> + </TypePattern.Match> + + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <Or> + <Kind Is="Constructor" /> + <And> + <Kind Is="Method" /> + <ImplementsInterface Name="System.IDisposable" /> + </And> + </Or> + </Entry.Match> + + <Entry.SortBy> + <Kind> + <Kind.Order> + <DeclarationKind>Constructor</DeclarationKind> + </Kind.Order> + </Kind> + </Entry.SortBy> + </Entry> + + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="false" /> + <HasAttribute Name="Xunit.TheoryAttribute" Inherited="false" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + + <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <Or> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureSourceAttribute" Inherited="true" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" /> + </And> + </HasMember> + </Or> + </And> + </TypePattern.Match> + + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureSetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureTearDownAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.OneTimeSetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.OneTimeTearDownAttribute" Inherited="true" /> + </Or> + </And> + </Entry.Match> + </Entry> + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + + <TypePattern DisplayName="Default Pattern"> + <Entry DisplayName="Public Delegates" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Delegate" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Public Enums" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Static Fields and Constants"> + <Entry.Match> + <Or> + <Kind Is="Constant" /> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Or> + </Entry.Match> + + <Entry.SortBy> + <Kind> + <Kind.Order> + <DeclarationKind>Constant</DeclarationKind> + <DeclarationKind>Field</DeclarationKind> + </Kind.Order> + </Kind> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Fields"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + </And> + </Entry.Match> + + <Entry.SortBy> + <Readonly /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Properties, Indexers"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + </Or> + </Entry.Match> + </Entry> + <Entry DisplayName="Constructors"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + + <Entry.SortBy> + <Static/> + </Entry.SortBy> + </Entry> + + + + <Entry DisplayName="Interface Implementations" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Member" /> + <ImplementsInterface /> + </And> + </Entry.Match> + + <Entry.SortBy> + <ImplementsInterface Immediate="true" /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Nested Types"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + </Entry> + </TypePattern> +</Patterns> + + False + <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></Policy> + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample/Postgres.Sample.csproj b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample/Postgres.Sample.csproj index 8d2112eec..0ba5f231e 100644 --- a/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample/Postgres.Sample.csproj +++ b/Samples/Tutorials/3.PostgresSample/Postgres.Sample/Postgres.Sample/Postgres.Sample.csproj @@ -1,15 +1,15 @@ - net8.0 + net9.0 enable enable - - - + + +