Skip to content

Commit

Permalink
upgraded to dotnet9 (#116)
Browse files Browse the repository at this point in the history
* updated nuget packages
* updated project versions
* removed .net version compiler directive
* ran dotnet format
* Update ci-common-abstractions.yml
* Update ci-common-data-sql.yml
* Update ci-common-efcore-sql.yml
* Update ci-common-efcore.yml
* Update ci-common-fluentvalidation.yml
* Update ci-common.yml
  • Loading branch information
jeremyknight-me authored Nov 14, 2024
1 parent 861b40c commit fe60daf
Show file tree
Hide file tree
Showing 43 changed files with 322 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-common-abstractions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
9.x
8.x
- name: Build
run: dotnet build ./src/JK.Common.Abstractions/JK.Common.Abstractions.csproj -c Release
3 changes: 2 additions & 1 deletion .github/workflows/ci-common-data-sql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
9.x
8.x
- name: Build
run: dotnet build ./src/JK.Common.Data.Sql/JK.Common.Data.Sql.csproj -c Release
- name: Test
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-common-efcore-sql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
9.x
8.x
- name: Build
run: dotnet build ./src/JK.Common.EntityFrameworkCore.SqlServer/JK.Common.EntityFrameworkCore.SqlServer.csproj -c Release
3 changes: 2 additions & 1 deletion .github/workflows/ci-common-efcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
9.x
8.x
- name: Build
run: dotnet build ./src/JK.Common.EntityFrameworkCore/JK.Common.EntityFrameworkCore.csproj -c Release
- name: Test
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-common-fluentvalidation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
9.x
8.x
- name: Build
run: dotnet build ./src/JK.Common.FluentValidation/JK.Common.FluentValidation.csproj -c Release
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
9.x
8.x
- name: Build
run: dotnet build ./src/JK.Common/JK.Common.csproj -c Release
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<LangVersion>12.0</LangVersion>
<LangVersion>13.0</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>

Expand Down
10 changes: 10 additions & 0 deletions src/JK.Common.Abstractions/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).

## 2.0.0

### Added

- Added support for .NET 9.

### Removed

- Removed support for .NET 6.

## 1.1.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/JK.Common.Abstractions/JK.Common.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Version>1.1.0</Version>
<Version>2.0.0</Version>
<Description>Abstractions used in utility libraries which allows for less dependencies to be shared across projects.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ internal static SqlParameter AssertSingleAndReturn(SqlCommand command, string ex
var parameter = command.Parameters[0];
Assert.Equal(expectedName, parameter.ParameterName);
return parameter;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;net48</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0;net48</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
10 changes: 9 additions & 1 deletion src/JK.Common.Data.Sql/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ 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).

## Unreleased
## 6.0.0

## Added

- Added support for .NET 9.

### Changed

- Upgraded `Microsoft.Data.SqlClient` to v5.2.0

### Removed

- Removed support for .NET 6.

## 5.2.0

### Added
Expand Down
43 changes: 21 additions & 22 deletions src/JK.Common.Data.Sql/Extensions/SqlBulkCopyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,30 @@
using System.Text.RegularExpressions;
using Microsoft.Data.SqlClient;

namespace JK.Common.Data.Sql.Extensions
namespace JK.Common.Data.Sql.Extensions;

public static class SqlBulkCopyExtensions
{
public static class SqlBulkCopyExtensions
public static void ThrowIfColumnLengthException(this SqlBulkCopy bulk, SqlException ex)
{
public static void ThrowIfColumnLengthException(this SqlBulkCopy bulk, SqlException ex)
if (ex.Message.Contains("Received an invalid column length from the bcp client for colid"))
{
if (ex.Message.Contains("Received an invalid column length from the bcp client for colid"))
{
var pattern = @"\d+";
var match = Regex.Match(ex.Message.ToString(), pattern);
var index = Convert.ToInt32(match.Value) - 1;
var sortedColumnsField = typeof(SqlBulkCopy).GetField("_sortedColumnMappings", BindingFlags.NonPublic | BindingFlags.Instance);
var sortedColumns = sortedColumnsField.GetValue(bulk);
var itemsField = sortedColumns.GetType().GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
var items = (object[])itemsField.GetValue(sortedColumns);
var itemdata = items[index].GetType().GetField("_metadata", BindingFlags.NonPublic | BindingFlags.Instance);
var metadata = itemdata.GetValue(items[index]);
var column = metadata.GetType()
.GetField("column", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(metadata);
var length = metadata.GetType()
.GetField("length", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(metadata);
throw new DataException($"Column '{column}' contains data with a length greater than {length}", ex);
}
var pattern = @"\d+";
var match = Regex.Match(ex.Message.ToString(), pattern);
var index = Convert.ToInt32(match.Value) - 1;
var sortedColumnsField = typeof(SqlBulkCopy).GetField("_sortedColumnMappings", BindingFlags.NonPublic | BindingFlags.Instance);
var sortedColumns = sortedColumnsField.GetValue(bulk);
var itemsField = sortedColumns.GetType().GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
var items = (object[])itemsField.GetValue(sortedColumns);
var itemdata = items[index].GetType().GetField("_metadata", BindingFlags.NonPublic | BindingFlags.Instance);
var metadata = itemdata.GetValue(items[index]);
var column = metadata.GetType()
.GetField("column", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(metadata);
var length = metadata.GetType()
.GetField("length", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(metadata);
throw new DataException($"Column '{column}' contains data with a length greater than {length}", ex);
}
}
}
9 changes: 4 additions & 5 deletions src/JK.Common.Data.Sql/IsExternalInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

using System.ComponentModel;

namespace System.Runtime.CompilerServices
namespace System.Runtime.CompilerServices;

[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}
}

#endif
4 changes: 2 additions & 2 deletions src/JK.Common.Data.Sql/JK.Common.Data.Sql.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netstandard2.0</TargetFrameworks>
<Version>5.2.0</Version>
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<Version>6.0.0</Version>
<Description>A utility library containing extensions to System.Data.SqlClient</Description>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/JK.Common.Data.Sql/SqlBulkInsertOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace JK.Common.Data.Sql;

public class SqlBulkInsertOperation<T>
public class SqlBulkInsertOperation<T>
{
private readonly IAdoConnectionFactory connectionFactory;

Expand Down
8 changes: 6 additions & 2 deletions src/JK.Common.EntityFrameworkCore.SqlServer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ 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).

## Unreleased
## 4.0.0

## Added

- Added support for .NET 9.

### Changed

- Updated `Microsoft.EntityFrameworkCore.SqlServer`

### Removed

- Support for .NET Standard 2.0
- Removed support for .NET Standard 2.0 and .NET 6

## 3.2.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#if NET6_0_OR_GREATER

using System;
using System;

namespace JK.Common.EntityFrameworkCore.SqlServer.Extensions;

Expand All @@ -12,5 +10,3 @@ public static void ApplyConventionPreferences(this ModelConfigurationBuilder con
configurationBuilder.Properties<DateTimeOffset>().HavePrecision(2);
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>3.2.0</Version>
<Version>4.0.0</Version>
<Description>A utility library containing extensions to Microsoft.EntityFrameworkCore.SqlServer</Description>
</PropertyGroup>

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

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.20" />
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -18,14 +18,9 @@
</PackageReference>
</ItemGroup>

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

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.20" />
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/JK.Common.EntityFrameworkCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ 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).

## Unreleased
## 5.0.0

### Added

- Added support for .NET 9.
- Added `AuditableSaveChangesInterceptor`

### Changed
Expand All @@ -19,7 +20,7 @@ Unless otherwise noted, all changes made by [@jeremyknight-me](https://github.co

### Removed

- Removed support for .NET Standard 2.0
- Removed support for .NET Standard 2.0 and .NET 6
- Removed `ChangeTrackerExtensions` in favor of interceptor

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

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>A utility library containing extensions to Microsoft.EntityFrameworkCore</Description>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<Version>4.1.0</Version>
<Version>5.0.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

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

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
10 changes: 8 additions & 2 deletions src/JK.Common.FluentValidation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ 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).

## Unreleased
## 4.0.0

Nothing at this time.
## Added

- Added support for .NET 9.

### Removed

- Removed support for .NET Standard 2.0, .NET 6, and .NET 7

## 3.1.0

Expand Down
Loading

0 comments on commit fe60daf

Please sign in to comment.