Skip to content

Commit ecbea54

Browse files
Migrate chapter 4 contracts solution to .NET 10 and add central package management (#240)
1 parent 9e8dfa7 commit ecbea54

File tree

38 files changed

+157
-188
lines changed

38 files changed

+157
-188
lines changed

.github/workflows/chapter-4-contracts-workflow.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
env:
1414
CHAPTER_DIR: "Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src"
15-
NUGET_SOURCE_NAME: "evolutionaryArchitecture"
15+
NUGET_SOURCE_NAME: "EvolutionaryArchitecture"
1616

1717
jobs:
1818
build:
@@ -27,14 +27,14 @@ jobs:
2727
- name: Setup .NET
2828
uses: actions/setup-dotnet@v3
2929
with:
30-
dotnet-version: 9.0.x
31-
- name: Add Evolutionary Architecture Nuget Source
32-
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@main
33-
with:
34-
github-token: ${{ secrets.GITHUB_TOKEN }}
35-
owner: ${{ github.repository_owner }}
36-
path: ${{ env.CHAPTER_DIR }}
37-
nuget-source-name: ${{ env.NUGET_SOURCE_NAME }}
30+
dotnet-version: 10.0.x
31+
- name: Authenticate to GitHub Packages
32+
run: |
33+
dotnet nuget update source ${{ env.NUGET_SOURCE_NAME }} \
34+
--username ${{ github.actor }} \
35+
--password ${{ secrets.GITHUB_TOKEN }} \
36+
--store-password-in-clear-text \
37+
--configfile nuget.config
3838
- name: Restore dependencies
3939
run: dotnet restore
4040
- name: Build
@@ -52,14 +52,14 @@ jobs:
5252
- name: Setup .NET
5353
uses: actions/setup-dotnet@v3
5454
with:
55-
dotnet-version: 9.0.x
56-
- name: Add Evolutionary Architecture Nuget Source
57-
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@main
58-
with:
59-
github-token: ${{ secrets.GITHUB_TOKEN }}
60-
owner: ${{ github.repository_owner }}
61-
path: ${{ env.CHAPTER_DIR }}
62-
nuget-source-name: ${{ env.NUGET_SOURCE_NAME }}
55+
dotnet-version: 10.0.x
56+
- name: Authenticate to GitHub Packages
57+
run: |
58+
dotnet nuget update source ${{ env.NUGET_SOURCE_NAME }} \
59+
--username ${{ github.actor }} \
60+
--password ${{ secrets.GITHUB_TOKEN }} \
61+
--store-password-in-clear-text \
62+
--configfile nuget.config
6363
- name: Restore dependencies
6464
run: dotnet restore
6565
- name: Test

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<AssemblyName>EvolutionaryArchitecture.$(MSBuildProjectName)</AssemblyName>
55
<RootNamespace>$(AssemblyName)</RootNamespace>
6-
<TargetFramework>net9.0</TargetFramework>
6+
<TargetFramework>net10.0</TargetFramework>
77
<AnalysisLevel>latest</AnalysisLevel>
88
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup Label="Production">
6+
<PackageVersion Include="ErrorOr" Version="2.0.1" />
7+
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.Api" Version="4.2.0" />
8+
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.Core" Version="4.2.0" />
9+
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.Infrastructure" Version="4.2.0" />
10+
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.IntegrationTestsToolbox" Version="4.2.0" />
11+
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.0.0" />
12+
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="13.0.0" />
13+
<PackageVersion Include="Aspire.Hosting.RabbitMQ" Version="13.0.0" />
14+
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.2" />
15+
<PackageVersion Include="MassTransit.Abstractions" Version="8.3.2" />
16+
<PackageVersion Include="MassTransit" Version="8.3.2" />
17+
<PackageVersion Include="MassTransit.RabbitMQ" Version="8.3.2" />
18+
<PackageVersion Include="MediatR" Version="12.5.0" />
19+
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
20+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
21+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
22+
<PackageVersion Include="Microsoft.OpenApi" Version="2.3.0" />
23+
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
24+
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.0.1" />
25+
</ItemGroup>
26+
<ItemGroup Label="Tests">
27+
<PackageVersion Include="Bogus" Version="35.6.3" />
28+
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.4.0" />
29+
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.UnitTesting" Version="4.2.0" />
30+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
31+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
32+
<PackageVersion Include="Shouldly" Version="4.3.0" />
33+
<PackageVersion Include="xunit" Version="2.9.3" />
34+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
35+
<PackageVersion Include="xunit.analyzers" Version="1.24.0" />
36+
<PackageVersion Include="xunit.categories" Version="2.0.8" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.15.0.120848" PrivateAssets="all" Condition="$(MSBuildProjectExtension) == '.csproj'" />
40+
</ItemGroup>
41+
</Project>

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Fitnet.Contracts.Api.UnitTests/Fitnet.Contracts.Api.UnitTests.csproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<ItemGroup>
3-
<PackageReference Include="Bogus" Version="35.6.1" />
4-
<PackageReference Include="Shouldly" Version="4.3.0" />
5-
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
6-
<PackageReference Include="xunit" Version="2.9.2" />
7-
<PackageReference Include="xunit.analyzers" Version="1.18.0">
3+
<PackageReference Include="Bogus" />
4+
<PackageReference Include="Shouldly" />
5+
<PackageReference Include="xunit" />
6+
<PackageReference Include="xunit.analyzers">
87
<PrivateAssets>all</PrivateAssets>
98
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
109
</PackageReference>
11-
<PackageReference Include="xunit.categories" Version="2.0.8" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
10+
<PackageReference Include="xunit.categories" />
11+
<PackageReference Include="xunit.runner.visualstudio">
1312
<PrivateAssets>all</PrivateAssets>
1413
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1514
</PackageReference>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
17-
<PackageReference Include="coverlet.collector" Version="6.0.2">
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
16+
<PackageReference Include="coverlet.collector">
1817
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1918
<PrivateAssets>all</PrivateAssets>
2019
</PackageReference>

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Fitnet.Contracts.Api.UnitTests/SignContract/Signatures/SignatureTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
namespace EvolutionaryArchitecture.Fitnet.Contracts.Api.UnitTests.SignContract.Signatures;
2+
23
using EvolutionaryArchitecture.Fitnet.Contracts.Core.SignContract.Signatures;
34
using Core.SignContract.Signatures.Exceptions;
45

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Fitnet.Contracts.Api/AttachAnnexToBindingContract/AttachAnnexToBindingContractEndpoint.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ internal static void MapAttachAnnexToBindingContract(this IEndpointRouteBuilder
1818
await contractsModule.ExecuteCommandAsync(request.ToCommand(id), cancellationToken)
1919
.Match(annexId => Results.Created(BuildUrl(id, annexId), annexId),
2020
errors => errors.ToProblem()))
21-
.WithOpenApi(operation => new(operation)
22-
{
23-
Summary = "Attach annex to existing binding contract",
24-
Description = "This endpoint is used to attach an annex to an existing binding contract.",
25-
})
21+
.WithSummary("Attach annex to existing binding contract")
22+
.WithDescription("This endpoint is used to attach an annex to an existing binding contract.")
2623
.Produces<string>(StatusCodes.Status201Created)
2724
.Produces(StatusCodes.Status404NotFound)
2825
.Produces(StatusCodes.Status409Conflict)
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
23
<ItemGroup>
34
<ProjectReference Include="..\Fitnet.Contracts.Core\Fitnet.Contracts.Core.csproj" />
45
<ProjectReference Include="..\Fitnet.Contracts.Infrastructure\Fitnet.Contracts.Infrastructure.csproj" />
@@ -7,8 +8,6 @@
78

89
<ItemGroup>
910
<InternalsVisibleTo Include="EvolutionaryArchitecture.Fitnet.Contracts.IntegrationTests" />
10-
</ItemGroup>
11-
<ItemGroup>
1211
<InternalsVisibleTo Include="EvolutionaryArchitecture.Fitnet.Contracts.Api.UnitTests" />
1312
</ItemGroup>
1413

@@ -17,7 +16,7 @@
1716
</ItemGroup>
1817

1918
<ItemGroup>
20-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
19+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
2120
</ItemGroup>
2221

2322
</Project>

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Fitnet.Contracts.Api/PrepareContract/PrepareContractEndpoint.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ await contractsModule.ExecuteCommandAsync(request.ToCommand(), cancellationToken
1717
contractId => Results.Created(ContractsApiPaths.GetPreparedContractPath(contractId), (object?)contractId),
1818
errors => errors.ToProblem()))
1919
.ValidateRequest<PrepareContractRequest>()
20-
.WithOpenApi(operation => new(operation)
21-
{
22-
Summary = "Triggers preparation of a new contract for new or existing customer",
23-
Description =
24-
"This endpoint is used to prepare a new contract for new and existing customers.",
25-
})
20+
.WithSummary("Triggers preparation of a new contract for new or existing customer")
21+
.WithDescription("This endpoint is used to prepare a new contract for new and existing customers.")
2622
.Produces<string>(StatusCodes.Status201Created)
2723
.Produces(StatusCodes.Status409Conflict)
2824
.Produces(StatusCodes.Status500InternalServerError);

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Fitnet.Contracts.Api/SignContract/SignContractEndpoint.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ await contractsModule
2020
bindingContractId => Results.Created($"/{ContractsApiPaths.BindingContracts}/{bindingContractId}",
2121
bindingContractId), errors => errors.ToProblem()))
2222
.ValidateRequest<SignContractRequestValidator>()
23-
.WithOpenApi(operation => new(operation)
24-
{
25-
Summary = "Signs prepared contract",
26-
Description =
27-
"This endpoint is used to sign prepared contract by customer.",
28-
})
23+
.WithSummary("Signs prepared contract")
24+
.WithDescription("This endpoint is used to sign prepared contract by customer.")
2925
.Produces(StatusCodes.Status201Created)
3026
.Produces(StatusCodes.Status404NotFound)
3127
.Produces(StatusCodes.Status409Conflict)

Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src/Fitnet.Contracts.Api/TerminateBindingContract/TerminateBindingContractEndpoint.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ await contractsModule.ExecuteCommandAsync(new TerminateBindingContractCommand(bi
1919
.Match(
2020
_ => Results.NoContent(),
2121
errors => errors.ToProblem()))
22-
.WithOpenApi(operation => new(operation)
23-
{
24-
Summary = "Terminates binding contract",
25-
Description = "This endpoint is used to terminate an existing binding contract."
26-
})
22+
.WithSummary("Terminates binding contract")
23+
.WithDescription("This endpoint is used to terminate an existing binding contract.")
2724
.Produces(StatusCodes.Status204NoContent)
2825
.Produces(StatusCodes.Status404NotFound)
2926
.Produces(StatusCodes.Status409Conflict)

0 commit comments

Comments
 (0)