Skip to content

Commit 4a04823

Browse files
committed
Multi-target against .NET 6 and .NET 8
1 parent 24b9546 commit 4a04823

File tree

62 files changed

+266
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+266
-107
lines changed

.github/workflows/build.yml

+33-9
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ jobs:
4747
- name: Setup .NET
4848
uses: actions/setup-dotnet@v3
4949
with:
50-
dotnet-version: 6.0.x
50+
dotnet-version: |
51+
6.0.x
52+
8.0.x
53+
dotnet-quality: 'preview'
5154
- name: Setup PowerShell (Ubuntu)
5255
if: matrix.os == 'ubuntu-latest'
5356
run: |
@@ -87,8 +90,13 @@ jobs:
8790
- name: Git checkout
8891
uses: actions/checkout@v4
8992
- name: Restore tools
93+
shell: pwsh
9094
run: |
91-
dotnet tool restore
95+
# Temporary workaround for bug in .NET 8 RC2 at https://github.com/dotnet/sdk/issues/35989
96+
$tools = Get-Content ".config/dotnet-tools.json" | ConvertFrom-Json
97+
foreach ($tool in $tools.tools.PsObject.Properties) {
98+
& dotnet tool install $tool.Name --version $tool.Value.version
99+
}
92100
- name: Restore packages
93101
run: |
94102
dotnet restore
@@ -181,18 +189,26 @@ jobs:
181189
- name: Setup .NET
182190
uses: actions/setup-dotnet@v3
183191
with:
184-
dotnet-version: 6.0.x
192+
dotnet-version: |
193+
6.0.x
194+
8.0.x
195+
dotnet-quality: 'preview'
185196
- name: Git checkout
186197
uses: actions/checkout@v4
187198
- name: Restore tools
199+
shell: pwsh
188200
run: |
189-
dotnet tool restore
201+
# Temporary workaround for bug in .NET 8 RC2 at https://github.com/dotnet/sdk/issues/35989
202+
$tools = Get-Content ".config/dotnet-tools.json" | ConvertFrom-Json
203+
foreach ($tool in $tools.tools.PsObject.Properties) {
204+
& dotnet tool install $tool.Name --version $tool.Value.version
205+
}
190206
- name: InspectCode
191207
shell: pwsh
192208
run: |
193209
$inspectCodeOutputPath = Join-Path $env:RUNNER_TEMP 'jetbrains-inspectcode-results.xml'
194210
Write-Output "INSPECT_CODE_OUTPUT_PATH=$inspectCodeOutputPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
195-
dotnet jb inspectcode JsonApiDotNetCore.sln --build --output="$inspectCodeOutputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --properties:ContinuousIntegrationBuild=false --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
211+
dotnet jb inspectcode JsonApiDotNetCore.sln --build --dotnetcoresdk=$(dotnet --version) --output="$inspectCodeOutputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --properties:ContinuousIntegrationBuild=false --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
196212
- name: Verify outcome
197213
shell: pwsh
198214
run: |
@@ -232,14 +248,22 @@ jobs:
232248
- name: Setup .NET
233249
uses: actions/setup-dotnet@v3
234250
with:
235-
dotnet-version: 6.0.x
251+
dotnet-version: |
252+
6.0.x
253+
8.0.x
254+
dotnet-quality: 'preview'
236255
- name: Git checkout
237256
uses: actions/checkout@v4
238257
with:
239258
fetch-depth: 2
240259
- name: Restore tools
260+
shell: pwsh
241261
run: |
242-
dotnet tool restore
262+
# Temporary workaround for bug in .NET 8 RC2 at https://github.com/dotnet/sdk/issues/35989
263+
$tools = Get-Content ".config/dotnet-tools.json" | ConvertFrom-Json
264+
foreach ($tool in $tools.tools.PsObject.Properties) {
265+
& dotnet tool install $tool.Name --version $tool.Value.version
266+
}
243267
- name: Restore packages
244268
run: |
245269
dotnet restore
@@ -253,13 +277,13 @@ jobs:
253277
$baseCommitHash = git rev-parse HEAD~1
254278
255279
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
256-
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
280+
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
257281
- name: CleanupCode (on branch)
258282
if: github.event_name == 'push' || github.event_name == 'release'
259283
shell: pwsh
260284
run: |
261285
Write-Output "Running code cleanup on all files."
262-
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN --fail-on-diff --print-diff
286+
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version)--jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN --fail-on-diff --print-diff
263287
264288
publish:
265289
timeout-minutes: 60

Directory.Build.props

+6-28
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,21 @@
1313
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
1414
</PropertyGroup>
1515

16+
<!-- To be removed when stable .NET 8 version has been released. -->
1617
<PropertyGroup>
17-
<!-- Published dependencies (only update on major version change) -->
18-
<TargetFrameworkName>net6.0</TargetFrameworkName>
19-
<CodeAnalysisFrozenVersion>4.1.0</CodeAnalysisFrozenVersion>
20-
<DemystifierFrozenVersion>0.4.1</DemystifierFrozenVersion>
21-
<EntityFrameworkCoreFrozenVersion>6.0.0</EntityFrameworkCoreFrozenVersion>
22-
<HumanizerFrozenVersion>2.14.1</HumanizerFrozenVersion>
23-
24-
<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
25-
<AspNetCoreVersion>6.0.*</AspNetCoreVersion>
26-
<BenchmarkDotNetVersion>0.13.*</BenchmarkDotNetVersion>
27-
<BogusVersion>34.0.*</BogusVersion>
28-
<CSharpGuidelinesAnalyzerVersion>3.8.*</CSharpGuidelinesAnalyzerVersion>
29-
<CodeAnalysisVersion>4.7.*</CodeAnalysisVersion>
30-
<CoverletVersion>6.0.*</CoverletVersion>
31-
<DapperVersion>2.1.*</DapperVersion>
32-
<DateOnlyTimeOnlyVersion>2.1.*</DateOnlyTimeOnlyVersion>
33-
<EntityFrameworkCoreVersion>7.0.*</EntityFrameworkCoreVersion>
34-
<FluentAssertionsVersion>6.12.*</FluentAssertionsVersion>
35-
<GitHubActionsTestLoggerVersion>2.3.*</GitHubActionsTestLoggerVersion>
36-
<InheritDocVersion>1.3.*</InheritDocVersion>
37-
<JetBrainsAnnotationsVersion>2023.3.*</JetBrainsAnnotationsVersion>
38-
<NpgsqlVersion>7.0.*</NpgsqlVersion>
39-
<SourceLinkVersion>1.1.*</SourceLinkVersion>
40-
<SystemTextJsonVersion>7.0.*</SystemTextJsonVersion>
41-
<TestSdkVersion>17.8.*</TestSdkVersion>
42-
<XunitVersion>2.5.*</XunitVersion>
18+
<NoWarn>$(NoWarn);NU5104</NoWarn>
19+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
4320
</PropertyGroup>
4421

4522
<ItemGroup>
46-
<PackageReference Include="JetBrains.Annotations" Version="$(JetBrainsAnnotationsVersion)" PrivateAssets="All" />
47-
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="$(CSharpGuidelinesAnalyzerVersion)" PrivateAssets="All" />
23+
<PackageReference Include="JetBrains.Annotations" Version="2023.3.*" PrivateAssets="All" />
24+
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.*" PrivateAssets="All" />
4825
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CSharpGuidelinesAnalyzer.config" Visible="False" />
4926
</ItemGroup>
5027

5128
<PropertyGroup>
5229
<Nullable>enable</Nullable>
30+
<LangVersion>latest</LangVersion>
5331
<ImplicitUsings>enable</ImplicitUsings>
5432
<IsPackable>false</IsPackable>
5533
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>

JsonApiDotNetCore.sln

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1414
CSharpGuidelinesAnalyzer.config = CSharpGuidelinesAnalyzer.config
1515
Directory.Build.props = Directory.Build.props
1616
tests.runsettings = tests.runsettings
17+
package-versions.props = package-versions.props
1718
EndProjectSection
1819
EndProject
1920
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{026FBC6C-AF76-4568-9B87-EC73457899FD}"

NuGet.config

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<!-- Temporary workaround for bug in Npgsql 8 RC2 at https://github.com/npgsql/npgsql/issues/5326 -->
5+
<add key="Npgsql-nightly" value="https://www.myget.org/F/npgsql-vnext/api/v3/index.json" />
6+
7+
<!-- Temporary workaround until final 8.0 release of Pomelo.EntityFrameworkCore.MySql is available. -->
8+
<add key="pomelo-nightly"
9+
value="https://pkgs.dev.azure.com/pomelo-efcore/Pomelo.EntityFrameworkCore.MySql/_packaging/pomelo-efcore-public/nuget/v3/index.json" />
10+
11+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
12+
</packageSources>
13+
</configuration>

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,21 @@ See also our [versioning policy](./VERSIONING_POLICY.md).
7979
| JsonApiDotNetCore | Status | .NET | Entity Framework Core |
8080
| ----------------- | ----------- | -------- | --------------------- |
8181
| 3.x | Stable | Core 2.x | 2.x |
82-
| 4.x | Stable | Core 3.1 | 3.1 |
83-
| | | Core 3.1 | 5 |
82+
| 4.x | Stable | Core 3.1 | 3.1, 5 |
8483
| | | 5 | 5 |
8584
| | | 6 | 5 |
8685
| 5.0.0-5.0.2 | Stable | 6 | 6 |
87-
| 5.0.3+ | Stable | 6 | 6 |
88-
| | | 6 | 7 |
86+
| 5.0.3-5.4.0 | Stable | 6 | 6, 7 |
8987
| | | 7 | 7 |
88+
| 5.5+ | Stable | 6 | 6, 7 |
89+
| | | 7 | 7 |
90+
| | | 8 | 8 |
91+
| master | Preview | 6 | 6, 7 |
92+
| | | 7 | 7 |
93+
| | | 8 | 8 |
94+
| openapi | Preview | 6 | 6, 7 |
95+
| | | 7 | 7 |
96+
| | | 8 | 8 |
9097

9198
## Contributing
9299

benchmarks/Benchmarks.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>$(TargetFrameworkName)</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ServerGarbageCollection>true</ServerGarbageCollection>
66
</PropertyGroup>
77

8+
<Import Project="..\package-versions.props" />
9+
810
<ItemGroup>
911
<ProjectReference Include="..\src\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
1012
</ItemGroup>

cleanupcode.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ if ($revision) {
2828

2929
if ($baseCommitHash -eq $headCommitHash) {
3030
Write-Output "Running code cleanup on staged/unstaged files."
31-
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified
31+
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified
3232
VerifySuccessExitCode
3333
}
3434
else {
3535
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash, including staged/unstaged files."
36-
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash
36+
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash
3737
VerifySuccessExitCode
3838
}
3939
}
4040
else {
4141
Write-Output "Running code cleanup on all files."
42-
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN
42+
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN
4343
VerifySuccessExitCode
4444
}

docs/generate-examples.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Start-WebServer {
3434
Write-Output "Starting web server"
3535
$startTimeUtc = Get-Date -AsUTC
3636
$job = Start-Job -ScriptBlock {
37-
dotnet run --project ..\src\Examples\GettingStarted\GettingStarted.csproj --configuration Debug --property:TreatWarningsAsErrors=True --urls=http://0.0.0.0:14141
37+
dotnet run --project ..\src\Examples\GettingStarted\GettingStarted.csproj --framework net8.0 --configuration Debug --property:TreatWarningsAsErrors=True --urls=http://0.0.0.0:14141
3838
}
3939

4040
$webProcessId = $null

inspectcode.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if ($LastExitCode -ne 0) {
1010

1111
$outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml')
1212
$resultPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.html')
13-
dotnet jb inspectcode JsonApiDotNetCore.sln --build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
13+
dotnet jb inspectcode JsonApiDotNetCore.sln --dotnetcoresdk=$(dotnet --version) --build --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
1414

1515
if ($LastExitCode -ne 0) {
1616
throw "Code inspection failed with exit code $LastExitCode"

package-versions.props

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- Published dependencies (only update on major version change) -->
4+
<CodeAnalysisFrozenVersion>4.1.0</CodeAnalysisFrozenVersion>
5+
<DemystifierFrozenVersion>0.4.1</DemystifierFrozenVersion>
6+
<HumanizerFrozenVersion>2.14.1</HumanizerFrozenVersion>
7+
8+
<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
9+
<BenchmarkDotNetVersion>0.13.*</BenchmarkDotNetVersion>
10+
<BogusVersion>34.0.*</BogusVersion>
11+
<CSharpGuidelinesAnalyzerVersion>3.8.*</CSharpGuidelinesAnalyzerVersion>
12+
<CodeAnalysisVersion>4.7.*</CodeAnalysisVersion>
13+
<CoverletVersion>6.0.*</CoverletVersion>
14+
<DapperVersion>2.1.*</DapperVersion>
15+
<DateOnlyTimeOnlyVersion>2.1.*</DateOnlyTimeOnlyVersion>
16+
<FluentAssertionsVersion>6.12.*</FluentAssertionsVersion>
17+
<GitHubActionsTestLoggerVersion>2.3.*</GitHubActionsTestLoggerVersion>
18+
<InheritDocVersion>1.3.*</InheritDocVersion>
19+
<JetBrainsAnnotationsVersion>2023.2.*</JetBrainsAnnotationsVersion>
20+
<SourceLinkVersion>1.1.*</SourceLinkVersion>
21+
<TestSdkVersion>17.8.*</TestSdkVersion>
22+
<XunitVersion>2.5.*</XunitVersion>
23+
</PropertyGroup>
24+
25+
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
26+
<!-- Published dependencies (only update on major version change) -->
27+
<EntityFrameworkCoreFrozenVersion>8.0.0-*</EntityFrameworkCoreFrozenVersion>
28+
29+
<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
30+
<AspNetCoreVersion>8.0.0-*</AspNetCoreVersion>
31+
<EntityFrameworkCoreVersion>8.0.0-*</EntityFrameworkCoreVersion>
32+
<NpgsqlVersion>8.0.0-*</NpgsqlVersion>
33+
<SystemTextJsonVersion>$(AspNetCoreVersion)</SystemTextJsonVersion>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
37+
<!-- Published dependencies (only update on major version change) -->
38+
<EntityFrameworkCoreFrozenVersion>6.0.0</EntityFrameworkCoreFrozenVersion>
39+
40+
<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
41+
<AspNetCoreVersion>6.0.*</AspNetCoreVersion>
42+
<EntityFrameworkCoreVersion>7.0.*</EntityFrameworkCoreVersion>
43+
<NpgsqlVersion>7.0.*</NpgsqlVersion>
44+
<SystemTextJsonVersion>7.0.*</SystemTextJsonVersion>
45+
</PropertyGroup>
46+
</Project>

src/Examples/DapperExample/DapperExample.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>$(TargetFrameworkName)</TargetFramework>
3+
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
44
</PropertyGroup>
55

6+
<Import Project="..\..\..\package-versions.props" />
7+
68
<ItemGroup>
79
<ProjectReference Include="..\..\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
810
<ProjectReference Include="..\..\JsonApiDotNetCore.SourceGenerators\JsonApiDotNetCore.SourceGenerators.csproj" OutputItemType="Analyzer"

src/Examples/DapperExample/Definitions/TodoItemDefinition.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66
using JsonApiDotNetCore.Middleware;
77
using JsonApiDotNetCore.Queries.Expressions;
88
using JsonApiDotNetCore.Resources;
9-
using Microsoft.AspNetCore.Authentication;
109

1110
namespace DapperExample.Definitions;
1211

1312
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
1413
public sealed class TodoItemDefinition : JsonApiResourceDefinition<TodoItem, long>
1514
{
16-
private readonly ISystemClock _systemClock;
15+
private readonly IClock _clock;
1716

18-
public TodoItemDefinition(IResourceGraph resourceGraph, ISystemClock systemClock)
17+
public TodoItemDefinition(IResourceGraph resourceGraph, IClock clock)
1918
: base(resourceGraph)
2019
{
21-
ArgumentGuard.NotNull(systemClock);
20+
ArgumentGuard.NotNull(clock);
2221

23-
_systemClock = systemClock;
22+
_clock = clock;
2423
}
2524

2625
public override SortExpression OnApplySort(SortExpression? existingSort)
@@ -41,11 +40,11 @@ public override Task OnWritingAsync(TodoItem resource, WriteOperationKind writeO
4140
{
4241
if (writeOperation == WriteOperationKind.CreateResource)
4342
{
44-
resource.CreatedAt = _systemClock.UtcNow;
43+
resource.CreatedAt = _clock.UtcNow;
4544
}
4645
else if (writeOperation == WriteOperationKind.UpdateResource)
4746
{
48-
resource.LastModifiedAt = _systemClock.UtcNow;
47+
resource.LastModifiedAt = _clock.UtcNow;
4948
}
5049

5150
return Task.CompletedTask;

src/Examples/DapperExample/IClock.cs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace DapperExample;
2+
3+
public interface IClock
4+
{
5+
DateTimeOffset UtcNow { get; }
6+
}

src/Examples/DapperExample/Program.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using JsonApiDotNetCore.AtomicOperations;
1010
using JsonApiDotNetCore.Configuration;
1111
using JsonApiDotNetCore.Repositories;
12-
using Microsoft.AspNetCore.Authentication;
1312
using Microsoft.EntityFrameworkCore;
1413
using Microsoft.EntityFrameworkCore.Diagnostics;
1514
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -18,7 +17,7 @@
1817

1918
// Add services to the container.
2019

21-
builder.Services.TryAddSingleton<ISystemClock, SystemClock>();
20+
builder.Services.TryAddSingleton<IClock, SystemClock>();
2221

2322
DatabaseProvider databaseProvider = GetDatabaseProvider(builder.Configuration);
2423
string? connectionString = builder.Configuration.GetConnectionString($"DapperExample{databaseProvider}");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace DapperExample;
2+
3+
public sealed class SystemClock : IClock
4+
{
5+
public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
6+
}

src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>$(TargetFrameworkName)</TargetFramework>
3+
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
44
</PropertyGroup>
55

6+
<Import Project="..\..\..\package-versions.props" />
7+
68
<ItemGroup>
79
<ProjectReference Include="..\..\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
810
<ProjectReference Include="..\..\JsonApiDotNetCore.SourceGenerators\JsonApiDotNetCore.SourceGenerators.csproj" OutputItemType="Analyzer"

0 commit comments

Comments
 (0)