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

upgrade to Net8 #269

Merged
merged 12 commits into from
Jan 29, 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
15 changes: 15 additions & 0 deletions .github/release-drafter-v7.x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name-template: v$NEXT_PATCH_VERSION
tag-template: v$NEXT_PATCH_VERSION
categories:
- title: 🚀 Features
label: feature
- title: 🐛 Bug Fixes
label: fix
- title: 🛠️ Maintenance
label: chore
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
commitish: 'support/7.x'
filter-by-commitish: true
template: |
## Changes
$CHANGES
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Build and Test
run: ./Build.ps1
shell: pwsh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- run: |
dotnet build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Build and Test
run: ./Build.ps1
shell: pwsh
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="MinVer" Version="2.5.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\assets\img\icon.png" Pack="true" PackagePath=""/>
Expand Down
7 changes: 7 additions & 0 deletions NBB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{D282
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MicroServices", "MicroServices", "{CC43326A-DD67-4B00-80EE-C244B31A319F}"
ProjectSection(SolutionItems) = preProject
samples\MicroServices\NBB Samples.postman_collection.json = samples\MicroServices\NBB Samples.postman_collection.json
samples\MicroServices\README.md = samples\MicroServices\README.md
EndProjectSection
EndProject
Expand Down Expand Up @@ -220,6 +221,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NBB.Messaging.OpenTelemetry
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{F57779EB-9107-427D-A65C-5AA262C348E1}"
ProjectSection(SolutionItems) = preProject
.github\release-drafter-v4.x.yml = .github\release-drafter-v4.x.yml
.github\release-drafter-v5.x.yml = .github\release-drafter-v5.x.yml
.github\release-drafter-v6.x.yml = .github\release-drafter-v6.x.yml
.github\release-drafter-v7.x.yml = .github\release-drafter-v7.x.yml
.github\release-drafter.yml = .github\release-drafter.yml
EndProjectSection
EndProject
Expand Down Expand Up @@ -334,6 +339,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NBB.Messaging.DataContracts
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MultiTenancy", "MultiTenancy", "{FA5EB6F2-9864-46B9-B62E-13D6578D9009}"
ProjectSection(SolutionItems) = preProject
samples\MultiTenancy\MultiTenantTodoList.postman_collection.json = samples\MultiTenancy\MultiTenantTodoList.postman_collection.json
samples\MultiTenancy\README.md = samples\MultiTenancy\README.md
EndProjectSection
EndProject
Expand Down Expand Up @@ -372,6 +378,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{E7A719C2-1F6B-47DB-9708-3313EB2DBB4F}"
ProjectSection(SolutionItems) = preProject
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
.github\workflows\release-drafter.yml = .github\workflows\release-drafter.yml
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
Expand Down
77 changes: 38 additions & 39 deletions dependencies.props
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<Project>
<PropertyGroup Label="Package Versions">
<NewtonsoftJsonPackageVersion>13.0.1</NewtonsoftJsonPackageVersion>
<MediatRPackageVersion>11.1.0</MediatRPackageVersion>
<MediatRContractsPackageVersion>1.0.1</MediatRContractsPackageVersion>
<MediatRExtensionsMicrosoftDIPackageVersion>11.0.0</MediatRExtensionsMicrosoftDIPackageVersion>
<ScrutorPackageVersion>3.3.0</ScrutorPackageVersion>
<BenchmarkDotNetPackageVersion>0.13.1</BenchmarkDotNetPackageVersion>
<MoqPackageVersion>4.16.1</MoqPackageVersion>
<XunitPackageVersion>2.4.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.3</XunitRunnerVisualStudioPackageVersion>
<CoverletCollectorPackageVersion>3.1.0</CoverletCollectorPackageVersion>
<MicrosoftNetTestSdkPackageVersion>17.0.0</MicrosoftNetTestSdkPackageVersion>
<FsUnitPackageVersion>4.1.0</FsUnitPackageVersion>
<FluentAssertionsPackageVersion>6.3.0</FluentAssertionsPackageVersion>
<MicrosoftDataSqlClientPackageVersion>5.0.1</MicrosoftDataSqlClientPackageVersion>
<MicrosoftExtensionsPackagesVersion>7.0.0</MicrosoftExtensionsPackagesVersion>
<MicrosoftEntityFrameworkPackagesVersion>7.0.0</MicrosoftEntityFrameworkPackagesVersion>
<MicrosoftCSharpPackageVersion>4.7.0</MicrosoftCSharpPackageVersion>
<OpenTelemetryCorePackageVersion>1.5.0</OpenTelemetryCorePackageVersion>
<OpenTelemetryExtensionsHostingPackageVersion>1.5.0</OpenTelemetryExtensionsHostingPackageVersion>
<OpenTelemetryExtensionsPropagatorsPackageVersion>1.5.0</OpenTelemetryExtensionsPropagatorsPackageVersion>
<OpenTelemetryInstrumentationAspNetCorePackageVersion>1.0.0-rc9.14</OpenTelemetryInstrumentationAspNetCorePackageVersion>
<OpenTelemetryInstrumentationEFCorePackageVersion>1.0.0-beta.7</OpenTelemetryInstrumentationEFCorePackageVersion>
<OpenTelemetryInstrumentationHttpPackageVersion>1.0.0-rc9.14</OpenTelemetryInstrumentationHttpPackageVersion>
<OpenTelemetryInstrumentationRuntimePackageVersion>1.5.0</OpenTelemetryInstrumentationRuntimePackageVersion>
<OpenTelemetryExporterPrometheusHttpListenerPackageVersion>1.5.0-rc.1</OpenTelemetryExporterPrometheusHttpListenerPackageVersion>
<OpenTelemetryExporterPrometheusAspnetCorePackageVersion>1.5.0-rc.1</OpenTelemetryExporterPrometheusAspnetCorePackageVersion>
<PollyVersion>7.2.2</PollyVersion>
<SerilogPackageVersion>2.10.0</SerilogPackageVersion>
<SerilogExtensionsLoggingPackageVersion>3.1.0</SerilogExtensionsLoggingPackageVersion>
<SerilogSinksConsole>4.0.1</SerilogSinksConsole>
<SerilogSinksMSSqlServerPackageVersion>5.6.1</SerilogSinksMSSqlServerPackageVersion>
<SerilogAspNetCorePackageVersion>4.1.0</SerilogAspNetCorePackageVersion>
<AutoMapperPackageVersion>12.0.0</AutoMapperPackageVersion>
<NJsonSchemaPackageVersion>10.6.6</NJsonSchemaPackageVersion>
<AutoFixturePackageVersion>4.17.0</AutoFixturePackageVersion>
<JaegerPackageVersion>1.0.3</JaegerPackageVersion>
<SystemIdentityModelTokensJwtPackageVersion>6.15.0</SystemIdentityModelTokensJwtPackageVersion>
</PropertyGroup>
<PropertyGroup Label="Package Versions">
<NewtonsoftJsonPackageVersion>13.0.3</NewtonsoftJsonPackageVersion>
<MediatRPackageVersion>12.2.0</MediatRPackageVersion>
<MediatRContractsPackageVersion>2.0.1</MediatRContractsPackageVersion>
<ScrutorPackageVersion>4.2.2</ScrutorPackageVersion>
<BenchmarkDotNetPackageVersion>0.13.11</BenchmarkDotNetPackageVersion>
<MoqPackageVersion>4.20.70</MoqPackageVersion>
<XunitPackageVersion>2.6.3</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.5.5</XunitRunnerVisualStudioPackageVersion>
<CoverletCollectorPackageVersion>6.0.0</CoverletCollectorPackageVersion>
<MicrosoftNetTestSdkPackageVersion>17.8.0</MicrosoftNetTestSdkPackageVersion>
<FsUnitPackageVersion>5.6.1</FsUnitPackageVersion>
<FluentAssertionsPackageVersion>6.12.0</FluentAssertionsPackageVersion>
<MicrosoftDataSqlClientPackageVersion>5.1.2</MicrosoftDataSqlClientPackageVersion>
<MicrosoftExtensionsPackagesVersion>8.0.0</MicrosoftExtensionsPackagesVersion>
<MicrosoftEntityFrameworkPackagesVersion>8.0.0</MicrosoftEntityFrameworkPackagesVersion>
<MicrosoftCSharpPackageVersion>4.7.0</MicrosoftCSharpPackageVersion>
<OpenTelemetryCorePackageVersion>1.7.0</OpenTelemetryCorePackageVersion>
<OpenTelemetryExtensionsHostingPackageVersion>1.7.0</OpenTelemetryExtensionsHostingPackageVersion>
<OpenTelemetryExtensionsPropagatorsPackageVersion>1.7.0</OpenTelemetryExtensionsPropagatorsPackageVersion>
<OpenTelemetryInstrumentationAspNetCorePackageVersion>1.6.0-rc.1</OpenTelemetryInstrumentationAspNetCorePackageVersion>
<OpenTelemetryInstrumentationEFCorePackageVersion>1.0.0-beta.8</OpenTelemetryInstrumentationEFCorePackageVersion>
<OpenTelemetryInstrumentationHttpPackageVersion>1.6.0-rc.1</OpenTelemetryInstrumentationHttpPackageVersion>
<OpenTelemetryInstrumentationRuntimePackageVersion>1.5.1</OpenTelemetryInstrumentationRuntimePackageVersion>
<OpenTelemetryExporterPrometheusHttpListenerPackageVersion>1.5.0-rc.1</OpenTelemetryExporterPrometheusHttpListenerPackageVersion>
<OpenTelemetryExporterPrometheusAspnetCorePackageVersion>1.7.0-rc.1</OpenTelemetryExporterPrometheusAspnetCorePackageVersion>
<PollyVersion>8.2.0</PollyVersion>
<SerilogPackageVersion>3.1.1</SerilogPackageVersion>
<SerilogExtensionsLoggingPackageVersion>8.0.0</SerilogExtensionsLoggingPackageVersion>
<SerilogSinksConsole>5.0.1</SerilogSinksConsole>
<SerilogSinksMSSqlServerPackageVersion>6.5.0</SerilogSinksMSSqlServerPackageVersion>
<SerilogAspNetCorePackageVersion>8.0.0</SerilogAspNetCorePackageVersion>
<AutoMapperPackageVersion>12.0.1</AutoMapperPackageVersion>
<NJsonSchemaPackageVersion>10.9.0</NJsonSchemaPackageVersion>
<AutoFixturePackageVersion>4.18.1</AutoFixturePackageVersion>
<JaegerPackageVersion>1.0.3</JaegerPackageVersion>
<SystemIdentityModelTokensJwtPackageVersion>7.0.3</SystemIdentityModelTokensJwtPackageVersion>
</PropertyGroup>
</Project>
110 changes: 110 additions & 0 deletions samples/MicroServices/NBB Samples.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"variables": [],
"info": {
"name": "NBB Samples",
"_postman_id": "8a8a47f1-d934-e859-1450-0f113a99bacb",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "create contract",
"request": {
"url": "http://localhost:2047/api/contracts",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ClientId\": \"3317223e-22ea-48dc-bc34-fff6ab3b9481\"\n}"
},
"description": null
},
"response": []
},
{
"name": "add contract line",
"request": {
"url": "http://localhost:2047/api/contracts/99534474-4560-4240-88B7-8B14E03D2733/lines",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"Product\": \"Pere\",\n \"Price\": 23,\n \"Quantity\": 5,\n \"ContractId\": \"6FD1AC92-B280-4ABC-AE7D-6ADFB2D2B5A8\"\n}"
},
"description": ""
},
"response": []
},
{
"name": "validate contract",
"request": {
"url": "http://localhost:2047/api/contracts/A6159DB7-A23B-4A66-B011-B5644F0B8AED/validate",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ContractId\": \"6FD1AC92-B280-4ABC-AE7D-6ADFB2D2B5A8\"\n}"
},
"description": ""
},
"response": []
},
{
"name": "pay payable",
"request": {
"url": "http://localhost:2046/api/payables/0d64be94-9a86-4d65-b862-c401227a2292/pay",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"PayableId\": \"9C2CF598-2F3C-4617-BD29-C6C39319AE7B\"\n}"
},
"description": ""
},
"response": []
},
{
"name": "get invoice",
"request": {
"url": "http://localhost:2048/api/invoices/80E80EDF-60C9-4A44-A524-522074592435",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ClientId\": \"3317223e-22ea-48dc-bc34-fff6ab3b9481\"\n}"
},
"description": null
},
"response": []
}
]
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /usr/lib/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /usr/lib/ssl/openssl.cnf
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["NuGet.config", "."]
COPY ["dependencies.props", "."]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
<UserSecretsId>NBB_Contracts_6a73f87d-2175-4be0-9a42-31cb73bc8e10</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand All @@ -21,18 +21,18 @@

<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="$(OpenTelemetryCorePackageVersion)" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="$(OpenTelemetryCorePackageVersion)" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="$(OpenTelemetryCorePackageVersion)" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="$(OpenTelemetryExporterPrometheusAspnetCorePackageVersion)" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="$(OpenTelemetryExtensionsHostingPackageVersion)" />
<PackageReference Include="OpenTelemetry.Extensions.Propagators" Version="$(OpenTelemetryExtensionsPropagatorsPackageVersion)" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="$(OpenTelemetryInstrumentationAspNetCorePackageVersion)" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="$(OpenTelemetryInstrumentationEFCorePackageVersion)" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="$(OpenTelemetryInstrumentationHttpPackageVersion)" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="$(OpenTelemetryInstrumentationRuntimePackageVersion)" />
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogAspNetCorePackageVersion)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsole)" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Serilog.AspNetCore" Version="$(SerilogAspNetCorePackageVersion)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="$(SerilogExtensionsLoggingPackageVersion)" />
<PackageReference Include="Serilog.Sinks.Console" Version="$(SerilogSinksConsole)" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ void configureResource(ResourceBuilder r) =>
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation()
.AddEntityFrameworkCoreInstrumentation(options => options.SetDbStatementForText = true)
.AddJaegerExporter()
.AddOtlpExporter()
);
services.Configure<JaegerExporterOptions>(Configuration.GetSection("OpenTelemetry:Jaeger"));
services.Configure<OtlpExporterOptions>(Configuration.GetSection("OpenTelemetry:Otlp"));
}

if (Configuration.GetValue<bool>("OpenTelemetry:MetricsEnabled"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@
"OpenTelemetry": {
"MetricsEnabled": true,
"TracingEnabled": true,
"Jaeger": {
//"AgentHost": "localhost",
//"AgentPort": 6831,
//"Protocol": "UdpCompactThrift",
"Endpoint": "YOUR_COLLECTOR_URL",
"Protocol": "HttpBinaryThrift"
"Otlp": {
"Endpoint": "YOUR_COLLECTOR_URL"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,28 @@ public ContractCommandHandlers(IEventSourcedRepository<Contract> repository, Con
_logger = logger;
}

public async Task<Unit> Handle(CreateContract command, CancellationToken cancellationToken)
public async Task Handle(CreateContract command, CancellationToken cancellationToken)
{
var contract = new Contract(command.ClientId);
await _repository.SaveAsync(contract, cancellationToken);
_domainMetrics.ContractCreated();

return Unit.Value;
}

public async Task<Unit> Handle(AddContractLine command, CancellationToken cancellationToken)
public async Task Handle(AddContractLine command, CancellationToken cancellationToken)
{
var contract = await _repository.GetByIdAsync(command.ContractId, cancellationToken);
contract.AddContractLine(command.Product, command.Price, command.Quantity);
await _repository.SaveAsync(contract, cancellationToken);

return Unit.Value;
}

public async Task<Unit> Handle(ValidateContract command, CancellationToken cancellationToken)
public async Task Handle(ValidateContract command, CancellationToken cancellationToken)
{
_logger.LogInformation("Validating contract");

var contract = await _repository.GetByIdAsync(command.ContractId, cancellationToken);
contract.Validate();
await _repository.SaveAsync(contract, cancellationToken);
_domainMetrics.ContractValidated();

return Unit.Value;
}
}
}
Loading
Loading