Skip to content

Commit 209dbb7

Browse files
committed
Drop .NET 6
1 parent 16c461d commit 209dbb7

File tree

43 files changed

+202
-258
lines changed

Some content is hidden

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

43 files changed

+202
-258
lines changed

Directory.Build.props

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@
5252
<NoWarn>$(NoWarn);CA1062</NoWarn>
5353
</PropertyGroup>
5454

55-
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
56-
<!-- Workaround for https://github.com/dotnet/runtime/issues/72263 -->
57-
<NoWarn>$(NoWarn);SYSLIB1006</NoWarn>
58-
</PropertyGroup>
59-
6055
<ItemGroup>
6156
<PackageReference Include="JetBrains.Annotations" Version="2024.2.*" PrivateAssets="All" />
6257
<PackageReference Include="CSharpGuidelinesAnalyzer" Version="3.8.*" PrivateAssets="All" />

JsonApiDotNetCore.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ JsonApiDotNetCore.ArgumentGuard.NotNull($EXPR$);</s:String>
1414
<s:Int64 x:Key="/Default/CodeEditing/NullCheckPatterns/PatternTypeNamesToPriority/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002ENullChecking_002EThrowExpressionNullCheckPattern/@EntryIndexedValue">3000</s:Int64>
1515
<s:Int64 x:Key="/Default/CodeEditing/NullCheckPatterns/PatternTypeNamesToPriority/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002ENullChecking_002ETraceAssertPattern/@EntryIndexedValue">50</s:Int64>
1616
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/PropagateAnnotations/@EntryValue">False</s:Boolean>
17+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/GeneratedFilesAndFolders/=83FF097C_002DC8C6_002D477B_002D9FAB_002DDF99B84978B5_002Ff_003AReadOnlySet_002Ecs/@EntryIndexedValue">83FF097C-C8C6-477B-9FAB-DF99B84978B5/f:ReadOnlySet.cs</s:String>
1718
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
1819
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IdentifierHighlightingEnabled/@EntryValue">True</s:Boolean>
1920
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IncludeWarningsInSwea/@EntryValue">True</s:Boolean>

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,9 @@ See also our [versioning policy](./VERSIONING_POLICY.md).
8787
| | | 7 | 7 |
8888
| | | 8 | 8, 9 |
8989
| | | 9 | 9 |
90-
| master | Preview | 6 | 6, 7 |
91-
| | | 7 | 7 |
92-
| | | 8 | 8, 9 |
90+
| master | Preview | 8 | 8, 9 |
9391
| | | 9 | 9 |
94-
| openapi | Experimental | 6 | 6, 7 |
95-
| | | 7 | 7 |
96-
| | | 8 | 8, 9 |
92+
| openapi | Experimental | 8 | 8, 9 |
9793
| | | 9 | 9 |
9894

9995
## Contributing

package-versions.props

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<GitHubActionsTestLoggerVersion>2.4.*</GitHubActionsTestLoggerVersion>
1616
<InheritDocVersion>2.0.*</InheritDocVersion>
1717
<SourceLinkVersion>8.0.*</SourceLinkVersion>
18+
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
1819
<TestSdkVersion>17.11.*</TestSdkVersion>
1920
<XunitVersion>2.9.*</XunitVersion>
2021
<XunitVisualStudioVersion>2.8.*</XunitVisualStudioVersion>
@@ -28,7 +29,6 @@
2829
<AspNetCoreVersion>9.0.*</AspNetCoreVersion>
2930
<EntityFrameworkCoreVersion>9.0.*</EntityFrameworkCoreVersion>
3031
<EntityFrameworkCorePomeloVersion>9.0.0-*</EntityFrameworkCorePomeloVersion>
31-
<SystemTextJsonVersion>$(AspNetCoreVersion)</SystemTextJsonVersion>
3232
</PropertyGroup>
3333

3434
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
@@ -39,18 +39,5 @@
3939
<AspNetCoreVersion>8.0.*</AspNetCoreVersion>
4040
<EntityFrameworkCoreVersion>8.0.*</EntityFrameworkCoreVersion>
4141
<EntityFrameworkCorePomeloVersion>$(EntityFrameworkCoreVersion)</EntityFrameworkCorePomeloVersion>
42-
<SystemTextJsonVersion>$(AspNetCoreVersion)</SystemTextJsonVersion>
43-
</PropertyGroup>
44-
45-
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
46-
<!-- Published dependencies (only update on major version change) -->
47-
<EntityFrameworkCoreFrozenVersion>6.0.0</EntityFrameworkCoreFrozenVersion>
48-
49-
<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
50-
<AspNetCoreVersion>6.0.*</AspNetCoreVersion>
51-
<DateOnlyTimeOnlyVersion>2.1.*</DateOnlyTimeOnlyVersion>
52-
<EntityFrameworkCoreVersion>7.0.*</EntityFrameworkCoreVersion>
53-
<EntityFrameworkCorePomeloVersion>$(EntityFrameworkCoreVersion)</EntityFrameworkCorePomeloVersion>
54-
<SystemTextJsonVersion>8.0.*</SystemTextJsonVersion>
5542
</PropertyGroup>
5643
</Project>

src/Examples/DapperExample/DapperExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/Examples/DapperExample/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
}
3232
case DatabaseProvider.MySql:
3333
{
34-
#if NET9_0_OR_GREATER
35-
ServerVersion serverVersion = await ServerVersion.AutoDetectAsync(connectionString);
36-
#else
34+
#if NET8_0
3735
ServerVersion serverVersion = ServerVersion.AutoDetect(connectionString);
36+
#else
37+
ServerVersion serverVersion = await ServerVersion.AutoDetectAsync(connectionString);
3838
#endif
3939

4040
builder.Services.AddMySql<AppDbContext>(connectionString, serverVersion, optionsAction: options => SetDbContextDebugOptions(options));

src/Examples/DapperExample/Repositories/ResultSetMapper.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using JsonApiDotNetCore.Queries.Expressions;
44
using JsonApiDotNetCore.Resources;
55
using JsonApiDotNetCore.Resources.Annotations;
6-
#if NET6_0
7-
using JsonApiDotNetCore;
8-
#endif
96

107
namespace DapperExample.Repositories;
118

src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/Examples/GettingStarted/GettingStarted.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/Examples/JsonApiDotNetCoreExample/Definitions/TodoItemDefinition.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,14 @@
55
using JsonApiDotNetCore.Queries.Expressions;
66
using JsonApiDotNetCore.Resources;
77
using JsonApiDotNetCoreExample.Models;
8-
#if NET6_0
9-
using Microsoft.AspNetCore.Authentication;
10-
#endif
118

129
namespace JsonApiDotNetCoreExample.Definitions;
1310

1411
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
15-
public sealed class TodoItemDefinition(
16-
IResourceGraph resourceGraph,
17-
#if NET6_0
18-
ISystemClock systemClock
19-
#else
20-
TimeProvider timeProvider
21-
#endif
22-
)
12+
public sealed class TodoItemDefinition(IResourceGraph resourceGraph, TimeProvider timeProvider)
2313
: JsonApiResourceDefinition<TodoItem, long>(resourceGraph)
2414
{
25-
#if NET6_0
26-
private readonly Func<DateTimeOffset> _getUtcNow = () => systemClock.UtcNow;
27-
#else
2815
private readonly Func<DateTimeOffset> _getUtcNow = timeProvider.GetUtcNow;
29-
#endif
3016

3117
public override SortExpression OnApplySort(SortExpression? existingSort)
3218
{

src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/Examples/JsonApiDotNetCoreExample/Program.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
using Microsoft.EntityFrameworkCore;
99
using Microsoft.EntityFrameworkCore.Diagnostics;
1010
using Microsoft.Extensions.DependencyInjection.Extensions;
11-
#if NET6_0
12-
using Microsoft.AspNetCore.Authentication;
13-
#endif
1411

1512
[assembly: ExcludeFromCodeCoverage]
1613

@@ -48,11 +45,7 @@ static void ConfigureServices(WebApplicationBuilder builder)
4845
{
4946
using IDisposable _ = CodeTimingSessionManager.Current.Measure("Configure services");
5047

51-
#if NET6_0
52-
builder.Services.TryAddSingleton<ISystemClock, SystemClock>();
53-
#else
5448
builder.Services.TryAddSingleton(TimeProvider.System);
55-
#endif
5649

5750
builder.Services.AddDbContext<AppDbContext>(options =>
5851
{

src/Examples/MultiDbContextExample/MultiDbContextExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/Examples/NoEntityFrameworkExample/Repositories/InMemoryResourceRepository.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ public Task<IReadOnlyCollection<TResource>> GetAsync(QueryLayer queryLayer, Canc
3232
IEnumerable<TResource> dataSource = GetDataSource();
3333
IEnumerable<TResource> resources = _queryLayerToLinqConverter.ApplyQueryLayer(queryLayer, dataSource);
3434

35-
#if NET6_0
36-
return Task.FromResult<IReadOnlyCollection<TResource>>(Array.AsReadOnly(resources.ToArray()));
37-
#else
3835
return Task.FromResult<IReadOnlyCollection<TResource>>(resources.ToArray().AsReadOnly());
39-
#endif
4036
}
4137

4238
/// <inheritdoc />

src/Examples/NoEntityFrameworkExample/Services/InMemoryResourceService.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ public Task<IReadOnlyCollection<TResource>> GetAsync(CancellationToken cancellat
6565
_paginationContext.IsPageFull = true;
6666
}
6767

68-
#if NET6_0
69-
return Task.FromResult<IReadOnlyCollection<TResource>>(Array.AsReadOnly(resources));
70-
#else
7168
return Task.FromResult<IReadOnlyCollection<TResource>>(resources.AsReadOnly());
72-
#endif
7369
}
7470

7571
private void LogFiltersInTopScope()

src/Examples/ReportsExample/ReportsExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0;net8.0;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
44
</PropertyGroup>
55

66
<Import Project="..\..\..\package-versions.props" />

src/JsonApiDotNetCore.Annotations/ArgumentGuard.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,12 @@ public static void NotNullNorEmpty<T>([SysNotNull] IEnumerable<T>? value, [Calle
3030
[AssertionMethod]
3131
public static void NotNullNorEmpty([SysNotNull] string? value, [CallerArgumentExpression(nameof(value))] string? parameterName = null)
3232
{
33-
#if !NET6_0
3433
ArgumentException.ThrowIfNullOrEmpty(value, parameterName);
35-
#else
36-
ArgumentNullException.ThrowIfNull(value, parameterName);
37-
38-
if (value.Length == 0)
39-
{
40-
throw new ArgumentException("String cannot be null or empty.", parameterName);
41-
}
42-
#endif
4334
}
4435

4536
[AssertionMethod]
4637
public static void NotNullNorWhitespace([SysNotNull] string? value, [CallerArgumentExpression(nameof(value))] string? parameterName = null)
4738
{
48-
#if !NET6_0
4939
ArgumentException.ThrowIfNullOrWhiteSpace(value, parameterName);
50-
#else
51-
ArgumentNullException.ThrowIfNull(value, parameterName);
52-
53-
if (string.IsNullOrWhiteSpace(value))
54-
{
55-
throw new ArgumentException("String cannot be null, empty, or whitespace.", parameterName);
56-
}
57-
#endif
5840
}
5941
}

src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net6.0;netstandard1.0</TargetFrameworks>
3+
<TargetFrameworks>net8.0;netstandard1.0</TargetFrameworks>
44
<IsPackable>true</IsPackable>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
66
<RootNamespace>JsonApiDotNetCore</RootNamespace>
Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
#if NET6_0
21
using System.Collections.ObjectModel;
3-
#endif
4-
5-
#if NET6_0
6-
#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection
7-
#endif
82

93
namespace JsonApiDotNetCore;
104

@@ -13,22 +7,6 @@ internal static class PolyfillCollectionExtensions
137
{
148
public static IReadOnlySet<T> AsReadOnly<T>(this HashSet<T> source)
159
{
16-
// We can't use ReadOnlySet<T> yet, which is being introduced in .NET 9.
17-
return source;
18-
}
19-
20-
#if NET6_0
21-
public static ReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> source)
22-
where TKey : notnull
23-
{
24-
// The AsReadOnly() extension method is unavailable in .NET 6.
25-
return new ReadOnlyDictionary<TKey, TValue>(source);
26-
}
27-
28-
public static ReadOnlyCollection<T> AsReadOnly<T>(this T[] source)
29-
{
30-
// The AsReadOnly() extension method is unavailable in .NET 6.
31-
return Array.AsReadOnly(source);
10+
return new ReadOnlySet<T>(source);
3211
}
33-
#endif
3412
}

0 commit comments

Comments
 (0)