1
0

Adding support for .NET 8.0 LTS, renaming private fields to start with underscore

This commit is contained in:
2023-12-29 01:58:40 +01:00
parent 8bd511a936
commit 99d3f7758a
59 changed files with 922 additions and 871 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<NrtTagMatch>efc/v[0-9]*</NrtTagMatch>
@@ -21,11 +21,18 @@
<None Include="../README.md" Pack="true" PackagePath="/" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.23" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.23" />
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.25" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.25" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@@ -33,6 +33,8 @@ namespace System
: base(message, innerException)
{ }
#if NET6_0
/// <summary>
/// Initializes a new instance of the <see cref="DatabaseProviderException"/> class with serialized data.
/// </summary>
@@ -43,5 +45,7 @@ namespace System
protected DatabaseProviderException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
}

View File

@@ -24,6 +24,7 @@ namespace Microsoft.EntityFrameworkCore
/// <param name="optionsAction">An action to set additional options.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>true on success, otherwise false or an exception is thrown.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2208")]
public static async Task<bool> ApplyMigrationsAsync(this DatabaseFacade database, Action<DatabaseMigrationOptions> optionsAction, CancellationToken cancellationToken = default)
{
if (database == null)

View File

@@ -10,14 +10,14 @@ namespace AMWD.Common.EntityFrameworkCore.Extensions
public static class ModelConfigurationBuilderExtensions
{
/// <summary>
/// Adds converters for the <see cref="DateOnly"/> and <see cref="TimeOnly"/> datatypes introduced with .NET 6.0.
/// Adds converters for the <see cref="DateOnly"/> datatype introduced with .NET 6.0.
/// </summary>
/// <remarks>
/// As of 2022-06-04 only required for Microsoft SQL server on .NET 6.0.
/// </remarks>
/// <param name="builder">The <see cref="ModelConfigurationBuilder"/> instance.</param>
/// <returns>The <see cref="ModelConfigurationBuilder"/> instance after applying the converters.</returns>
public static ModelConfigurationBuilder AddDateOnlyTimeOnlyConverters(this ModelConfigurationBuilder builder)
public static ModelConfigurationBuilder AddDateOnlyConverters(this ModelConfigurationBuilder builder)
{
builder.Properties<DateOnly>()
.HaveConversion<DateOnlyConverter>()
@@ -26,6 +26,19 @@ namespace AMWD.Common.EntityFrameworkCore.Extensions
.HaveConversion<NullableDateOnlyConverter>()
.HaveColumnType("date");
return builder;
}
/// <summary>
/// Adds converters for the <see cref="TimeOnly"/> datatype introduced with .NET 6.0.
/// </summary>
/// <remarks>
/// As of 2022-06-04 only required for Microsoft SQL server on .NET 6.0.
/// </remarks>
/// <param name="builder">The <see cref="ModelConfigurationBuilder"/> instance.</param>
/// <returns>The <see cref="ModelConfigurationBuilder"/> instance after applying the converters.</returns>
public static ModelConfigurationBuilder AddTimeOnlyConverters(this ModelConfigurationBuilder builder)
{
builder.Properties<TimeOnly>()
.HaveConversion<TimeOnlyConverter>()
.HaveColumnType("time");

View File

@@ -0,0 +1,3 @@
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Usage", "CA2254")]