Skip to content

Commit

Permalink
more libraries to dotnet8 (#105)
Browse files Browse the repository at this point in the history
* added dotnet8 to fluentvalidation, data.sql, efcore, and efcore.sqlserver libraries
* refactored out GetUninitializedObjectHelper
  • Loading branch information
jeremyknight-me authored Jan 13, 2024
1 parent 450df75 commit 901e556
Show file tree
Hide file tree
Showing 25 changed files with 150 additions and 95 deletions.
10 changes: 5 additions & 5 deletions src/JK.Common.Data.Sql.Tests/JK.Common.Data.Sql.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>11.0</LangVersion>
<TargetFrameworks>net48;net6.0;net7.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
This is setup as if/else due to the following GitHub issue:
"Legacy serialization infrastructure APIs marked obsolete"
https://github.com/dotnet/docs/issues/34893
*/

namespace JK.Common.Data.Sql.Tests.TestUtils;

#if NET6_0_OR_GREATER

internal static class GetUninitializedObjectHelper
{
internal static T Instantiate<T>() where T : class
=> System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(typeof(T)) as T;
}

#else

internal static class GetUninitializedObjectHelper
{
internal static T Instantiate<T>() where T : class
=> System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof(T)) as T;
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System;
using System.Reflection;
using System.Runtime.Serialization;
using JK.Common.Data.Sql.Tests.TestUtils;
using Microsoft.Data.SqlClient;

namespace JK.Common.Data.Sql.TestUtils;
Expand Down Expand Up @@ -64,7 +64,7 @@ private static SqlError MakeSqlError(int number, string message)
/// WARNING: GetUninitializedObject doesn't call the constructor.
/// </summary>
private static T Instantiate<T>() where T : class
=> FormatterServices.GetUninitializedObject(typeof(T)) as T;
=> GetUninitializedObjectHelper.Instantiate<T>();
}

#endif
10 changes: 10 additions & 0 deletions src/JK.Common.Data.Sql/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Unless otherwise noted, all changes made by [@jeremyknight-me](https://github.com/jeremyknight-me).

## 5.2.0

### Added

- Added support for .NET 8

### Changed

- Upgraded `JK.Common.Abstractions` to v1.1.0

## 5.1.0

### Added
Expand Down
42 changes: 21 additions & 21 deletions src/JK.Common.Data.Sql/JK.Common.Data.Sql.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>11.0</LangVersion>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<Authors>Jeremy Knight</Authors>
<Version>5.1.0</Version>
<Copyright>Copyright Jeremy Knight. All rights reserved.</Copyright>
<Description>A utility library containing extensions to System.Data.SqlClient</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/jeremyknight-me/JK.Common</PackageProjectUrl>
<RepositoryUrl>https://github.com/jeremyknight-me/JK.Common</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<Authors>Jeremy Knight</Authors>
<Version>5.2.0</Version>
<Copyright>Copyright Jeremy Knight. All rights reserved.</Copyright>
<Description>A utility library containing extensions to System.Data.SqlClient</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/jeremyknight-me/JK.Common</PackageProjectUrl>
<RepositoryUrl>https://github.com/jeremyknight-me/JK.Common</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JK.Common.Abstractions" Version="1.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JK.Common.Abstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions src/JK.Common.EntityFrameworkCore.SqlServer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Unless otherwise noted, all changes made by [@jeremyknight-me](https://github.com/jeremyknight-me).

## 3.2.0

### Added

- Support for .NET 7 and .NET 8

### Removed

- Support for .NET 5 and .NET Standard 2.1

## 3.1.0

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace JK.Common.EntityFrameworkCore.SqlServer.Extensions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace JK.Common.EntityFrameworkCore.SqlServer.Extensions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>3.1.0</Version>
<Version>3.2.0</Version>
<Authors>Jeremy Knight</Authors>
<Company>Jeremy Knight</Company>
<Description>A utility library containing extensions to Microsoft.EntityFrameworkCore.SqlServer</Description>
Expand All @@ -15,20 +15,16 @@
<RepositoryUrl>https://github.com/jeremyknight-me/JK.Common</RepositoryUrl>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.4" />
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.12" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.12" />
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.24" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.32" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -19,14 +19,14 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.8" />
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.8" />
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.15" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/JK.Common.EntityFrameworkCore.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
global using Microsoft.EntityFrameworkCore;
global using System;
global using System;
global using System.ComponentModel.DataAnnotations;
global using Microsoft.EntityFrameworkCore;
global using Xunit;
6 changes: 6 additions & 0 deletions src/JK.Common.EntityFrameworkCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Unless otherwise noted, all changes made by [@jeremyknight-me](https://github.com/jeremyknight-me).

## 4.1.0

### Added

- Added support for .NET 8

## 4.0.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/JK.Common.EntityFrameworkCore/ChangeTrackerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;

namespace JK.Common.EntityFrameworkCore;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>A utility library containing extensions to Microsoft.EntityFrameworkCore</Description>
<PackageProjectUrl>https://github.com/jeremyknight-me/JK.Common</PackageProjectUrl>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<Version>4.0.0</Version>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<Version>4.1.0</Version>
<Authors>Jeremy Knight</Authors>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>Copyright Jeremy Knight. All rights reserved.</Copyright>
<RepositoryUrl>https://github.com/jeremyknight-me/JK.Common</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.11" />
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.15" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand Down
4 changes: 2 additions & 2 deletions src/JK.Common.EntityFrameworkCore/ReadOnlyDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System;
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

namespace JK.Common.EntityFrameworkCore;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
12 changes: 9 additions & 3 deletions src/JK.Common.FluentValidation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ Unless otherwise noted, all changes made by [@jeremyknight-me](https://github.co

## Unreleased

Nothing at this time.

## 3.1.0

### Added

- Added .NET 7 and .NET 8 to multi-targeting

### Changed

- Added .NET 7 to multi-targeting
- Upgraded FluentValidation from 10.x to 11.x
- Upgraded JK.Common to 5.0.0
- Upgraded JK.Common to 5.2.0

### Removed

- Removed .NET Standard 2.1 and .NET 5 from multi-targetting


## 3.0.0

### Added
Expand Down
Loading

0 comments on commit 901e556

Please sign in to comment.