Skip to content

Commit b7c44b9

Browse files
committed
Update to .NET 8 and EF Core 8 (preview 4)
1 parent 8290ca4 commit b7c44b9

File tree

8 files changed

+19
-17
lines changed

8 files changed

+19
-17
lines changed

Directory.Build.props

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFrameworkName>net7.0</TargetFrameworkName>
4-
<AspNetVersion>7.0.*</AspNetVersion>
5-
<EFCoreVersion>7.0.*</EFCoreVersion>
6-
<EFCorePostgresVersion>7.0.*</EFCorePostgresVersion>
7-
<MicrosoftCodeAnalysisVersion>4.5.*</MicrosoftCodeAnalysisVersion>
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>
7+
<MicrosoftCodeAnalysisVersion>4.6.*</MicrosoftCodeAnalysisVersion>
88
<HumanizerVersion>2.14.1</HumanizerVersion>
9-
<JsonApiDotNetCoreVersionPrefix>5.2.1</JsonApiDotNetCoreVersionPrefix>
9+
<JsonApiDotNetCoreVersionPrefix>5.2.1-pre</JsonApiDotNetCoreVersionPrefix>
1010
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodingGuidelines.ruleset</CodeAnalysisRuleSet>
1111
<WarningLevel>9999</WarningLevel>
1212
<Nullable>enable</Nullable>
1313
<ImplicitUsings>enable</ImplicitUsings>
1414
<IsPackable>false</IsPackable>
1515
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
16+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
1617
</PropertyGroup>
1718

1819
<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>
@@ -47,6 +48,6 @@
4748

4849
<ItemGroup>
4950
<PackageReference Include="Humanizer.Core" Version="$(HumanizerVersion)" PrivateAssets="all" GeneratePathProperty="true" />
50-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" PrivateAssets="all" />
51+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" />
5152
</ItemGroup>
5253
</Project>

src/JsonApiDotNetCore/JsonApiDotNetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<ItemGroup>
4040
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
4141
<PackageReference Include="Humanizer.Core" Version="$(HumanizerVersion)" />
42-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
43-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
42+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
43+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EFCoreVersion)" />
4444
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
4545
<PackageReference Include="SauceControl.InheritDoc" Version="1.3.0" PrivateAssets="All" />
4646
</ItemGroup>

src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs

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

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

598-
await entityEntry.Reference(inversePropertyName).LoadAsync(cancellationToken);
598+
await entityEntry.Reference(inversePropertyName).LoadAsync(cancellationToken: cancellationToken);
599599
}
600600

601601
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)

src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private bool SetETagResponseHeader(HttpRequest request, HttpResponse response, s
137137
string url = request.GetEncodedUrl();
138138
EntityTagHeaderValue responseETag = _eTagGenerator.Generate(url, responseContent);
139139

140-
response.Headers.Add(HeaderNames.ETag, responseETag.ToString());
140+
response.Headers.Append(HeaderNames.ETag, responseETag.ToString());
141141

142142
return RequestContainsMatchingETag(request.Headers, responseETag);
143143
}

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)