Skip to content

Commit 4dd264d

Browse files
committed
Update to .NET 8 and EF Core 8 (preview 4)
1 parent 12db854 commit 4dd264d

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

Directory.Build.props

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFrameworkName>net7.0</TargetFrameworkName>
4-
<AspNetVersion>7.0.*</AspNetVersion>
5-
<EFCoreVersion>7.0.*</EFCoreVersion>
6-
<EFCorePostgresVersion>7.0.*</EFCorePostgresVersion>
3+
<TargetFrameworkName>net8.0</TargetFrameworkName>
4+
<AspNetVersion>8.0.0-preview.4*</AspNetVersion>
5+
<EFCoreVersion>8.0.0-preview.4*</EFCoreVersion>
6+
<EFCorePostgresVersion>8.0.0-preview.4*</EFCorePostgresVersion>
77
<MicrosoftCodeAnalysisVersion>4.6.*</MicrosoftCodeAnalysisVersion>
88
<HumanizerVersion>2.14.1</HumanizerVersion>
9-
<JsonApiDotNetCoreVersionPrefix>5.3.1</JsonApiDotNetCoreVersionPrefix>
9+
<!-- workaround for "NU5104: A stable release of a package should not have a prerelease dependency." -->
10+
<JsonApiDotNetCoreVersionPrefix>5.3.1-net80</JsonApiDotNetCoreVersionPrefix>
1011
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
1112
<WarningLevel>9999</WarningLevel>
1213
<Nullable>enable</Nullable>
1314
<ImplicitUsings>enable</ImplicitUsings>
1415
<IsPackable>false</IsPackable>
1516
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
17+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
1618
</PropertyGroup>
1719

1820
<ItemGroup>

src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<NoWarn>$(NoWarn);NU5128</NoWarn>
88
<LangVersion>latest</LangVersion>
99
<IsRoslynComponent>true</IsRoslynComponent>
10+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
1011
</PropertyGroup>
1112

1213
<PropertyGroup>
@@ -50,6 +51,6 @@
5051

5152
<ItemGroup>
5253
<PackageReference Include="Humanizer.Core" Version="$(HumanizerVersion)" PrivateAssets="all" GeneratePathProperty="true" />
53-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" PrivateAssets="all" />
54+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" />
5455
</ItemGroup>
5556
</Project>

src/JsonApiDotNetCore/JsonApiDotNetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
<ItemGroup>
4343
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
4444
<PackageReference Include="Humanizer.Core" Version="$(HumanizerVersion)" />
45-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
46-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
45+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
46+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EFCoreVersion)" />
4747
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
4848
<PackageReference Include="SauceControl.InheritDoc" Version="1.3.0" PrivateAssets="All" />
4949
</ItemGroup>

src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public virtual async Task DeleteAsync(TResource? resourceFromDatabase, TId id, C
352352
if (RequiresLoadOfRelationshipForDeletion(relationship))
353353
{
354354
NavigationEntry navigation = GetNavigationEntry(resourceTracked, relationship);
355-
await navigation.LoadAsync(cancellationToken);
355+
await navigation.LoadAsync(cancellationToken: cancellationToken);
356356
}
357357
}
358358

@@ -596,7 +596,7 @@ protected async Task UpdateRelationshipAsync(RelationshipAttribute relationship,
596596
EntityEntry entityEntry = _dbContext.Entry(trackedValueToAssign);
597597
string inversePropertyName = relationship.InverseNavigationProperty!.Name;
598598

599-
await entityEntry.Reference(inversePropertyName).LoadAsync(cancellationToken);
599+
await entityEntry.Reference(inversePropertyName).LoadAsync(cancellationToken: cancellationToken);
600600
}
601601

602602
relationship.SetValue(leftResource, trackedValueToAssign);

src/JsonApiDotNetCore/Serialization/Response/FingerprintGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace JsonApiDotNetCore.Serialization.Response;
66
/// <inheritdoc />
77
internal sealed class FingerprintGenerator : IFingerprintGenerator
88
{
9-
private static readonly byte[] Separator = Encoding.UTF8.GetBytes("|");
9+
private static readonly byte[] Separator = "|"u8.ToArray();
1010
private static readonly uint[] LookupTable = Enumerable.Range(0, 256).Select(ToLookupEntry).ToArray();
1111

1212
private static uint ToLookupEntry(int index)

test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/ApiControllerAttributeTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task ApiController_attribute_transforms_NotFound_action_result_with
3333

3434
ErrorObject error = responseDocument.Errors[0];
3535
error.Links.ShouldNotBeNull();
36-
error.Links.About.Should().Be("https://tools.ietf.org/html/rfc7231#section-6.5.4");
36+
error.Links.About.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
3737
}
3838

3939
[Fact]
@@ -66,15 +66,15 @@ public async Task ProblemDetails_from_invalid_ModelState_is_translated_into_erro
6666
ErrorObject error1 = responseDocument.Errors[0];
6767
error1.StatusCode.Should().Be(HttpStatusCode.BadRequest);
6868
error1.Links.ShouldNotBeNull();
69-
error1.Links.About.Should().Be("https://tools.ietf.org/html/rfc7231#section-6.5.1");
69+
error1.Links.About.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.1");
7070
error1.Title.Should().Be("One or more validation errors occurred.");
7171
error1.Detail.Should().Be("The Name field is required.");
7272
error1.Source.Should().BeNull();
7373

7474
ErrorObject error2 = responseDocument.Errors[1];
7575
error2.StatusCode.Should().Be(HttpStatusCode.BadRequest);
7676
error2.Links.ShouldNotBeNull();
77-
error2.Links.About.Should().Be("https://tools.ietf.org/html/rfc7231#section-6.5.1");
77+
error2.Links.About.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.1");
7878
error2.Title.Should().Be("One or more validation errors occurred.");
7979
error2.Detail.Should().Be("The field YearOfBirth must be between 1900 and 2050.");
8080
error2.Source.Should().BeNull();

test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCoreVersion)" />
1717
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="$(EFCoreVersion)" />
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
19-
<PackageReference Include="System.Text.Json" Version="7.0.*" />
19+
<PackageReference Include="System.Text.Json" Version="$(AspNetVersion)" />
2020
</ItemGroup>
2121
</Project>

0 commit comments

Comments
 (0)