From 7469583ed44b5ea213f39e58dd46830acb84ca5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Tue, 1 Aug 2023 08:00:45 +0200 Subject: [PATCH] Removing .NET Core 3.1 support --- .../AMWD.Common.AspNetCore.csproj | 10 +++------ .../AMWD.Common.EntityFrameworkCore.csproj | 22 +++++++------------ .../Converters/DateOnlyConverter.cs | 6 +---- .../Converters/NullableDateOnlyConverter.cs | 6 +---- .../Converters/NullableTimeOnlyConverter.cs | 6 +---- .../Converters/TimeOnlyConverter.cs | 6 +---- .../Extensions/ModelBuilderExtensions.cs | 22 ------------------- .../ModelConfigurationBuilderExtensions.cs | 6 +---- AMWD.Common.Moq/AMWD.Common.Moq.csproj | 4 ---- AMWD.Common/AMWD.Common.csproj | 8 ++----- AMWD.Common/Extensions/StreamExtensions.cs | 14 ++++-------- Directory.Build.props | 7 ++++++ UnitTests/UnitTests.csproj | 10 ++++----- 13 files changed, 34 insertions(+), 93 deletions(-) diff --git a/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj b/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj index d960fa8..19c391f 100644 --- a/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj +++ b/AMWD.Common.AspNetCore/AMWD.Common.AspNetCore.csproj @@ -1,8 +1,8 @@ - + Debug;Release;DebugLocal - netcoreapp3.1;net6.0 + net6.0;net7.0 10.0 AMWD.Common.AspNetCore @@ -30,12 +30,8 @@ - + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - \ No newline at end of file diff --git a/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj b/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj index 6d425e2..d6697c1 100644 --- a/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj +++ b/AMWD.Common.EntityFrameworkCore/AMWD.Common.EntityFrameworkCore.csproj @@ -2,7 +2,7 @@ Debug;Release;DebugLocal - netcoreapp3.1;net6.0 + net6.0;net7.0 10.0 AMWD.Common.EntityFrameworkCore @@ -28,24 +28,18 @@ - - - - - - - - + + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + diff --git a/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs b/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs index 460e6a7..6dd9ea2 100644 --- a/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs +++ b/AMWD.Common.EntityFrameworkCore/Converters/DateOnlyConverter.cs @@ -1,6 +1,4 @@ -#if NET6_0_OR_GREATER - -using System; +using System; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace AMWD.Common.EntityFrameworkCore.Converters @@ -24,5 +22,3 @@ namespace AMWD.Common.EntityFrameworkCore.Converters { } } } - -#endif diff --git a/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs b/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs index 2587912..a002be5 100644 --- a/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs +++ b/AMWD.Common.EntityFrameworkCore/Converters/NullableDateOnlyConverter.cs @@ -1,6 +1,4 @@ -#if NET6_0_OR_GREATER - -using System; +using System; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace AMWD.Common.EntityFrameworkCore.Converters @@ -24,5 +22,3 @@ namespace AMWD.Common.EntityFrameworkCore.Converters { } } } - -#endif diff --git a/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs b/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs index bafc8ca..5399ace 100644 --- a/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs +++ b/AMWD.Common.EntityFrameworkCore/Converters/NullableTimeOnlyConverter.cs @@ -1,6 +1,4 @@ -#if NET6_0_OR_GREATER - -using System; +using System; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace AMWD.Common.EntityFrameworkCore.Converters @@ -24,5 +22,3 @@ namespace AMWD.Common.EntityFrameworkCore.Converters { } } } - -#endif diff --git a/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs b/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs index acb4ccc..4a56df5 100644 --- a/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs +++ b/AMWD.Common.EntityFrameworkCore/Converters/TimeOnlyConverter.cs @@ -1,6 +1,4 @@ -#if NET6_0_OR_GREATER - -using System; +using System; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace AMWD.Common.EntityFrameworkCore.Converters @@ -24,5 +22,3 @@ namespace AMWD.Common.EntityFrameworkCore.Converters { } } } - -#endif diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs b/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs index cccaf0c..0b5329a 100644 --- a/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs +++ b/AMWD.Common.EntityFrameworkCore/Extensions/ModelBuilderExtensions.cs @@ -3,9 +3,7 @@ using System.Reflection; using System.Text; using AMWD.Common.EntityFrameworkCore.Attributes; using Microsoft.EntityFrameworkCore; -#if NET6_0_OR_GREATER using Microsoft.EntityFrameworkCore.Metadata; -#endif namespace AMWD.Common.EntityFrameworkCore.Extensions { @@ -35,13 +33,7 @@ namespace AMWD.Common.EntityFrameworkCore.Extensions index.IsUnique = indexAttribute.IsUnique; if (!string.IsNullOrWhiteSpace(indexAttribute.Name)) - { -#if NET6_0_OR_GREATER index.SetDatabaseName(indexAttribute.Name.Trim()); -#else - index.SetName(indexAttribute.Name.Trim()); -#endif - } } } } @@ -60,28 +52,14 @@ namespace AMWD.Common.EntityFrameworkCore.Extensions { // skip conversion when table name is explicitly set if ((entityType.ClrType.GetCustomAttribute(typeof(TableAttribute), false) as TableAttribute) == null) - { -#if NET6_0_OR_GREATER entityType.SetTableName(ConvertToSnakeCase(entityType.GetTableName())); -#else - entityType.SetTableName(ConvertToSnakeCase(entityType.GetTableName())); -#endif - } -#if NET6_0_OR_GREATER var identifier = StoreObjectIdentifier.Table(entityType.GetTableName(), entityType.GetSchema()); -#endif foreach (var property in entityType.GetProperties()) { // skip conversion when column name is explicitly set if ((entityType.ClrType.GetProperty(property.Name)?.GetCustomAttribute(typeof(ColumnAttribute), false) as ColumnAttribute) == null) - { -#if NET6_0_OR_GREATER property.SetColumnName(ConvertToSnakeCase(property.GetColumnName(identifier))); -#else - property.SetColumnName(ConvertToSnakeCase(property.GetColumnName())); -#endif - } } } diff --git a/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs b/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs index 8c8f8b1..18289d2 100644 --- a/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs +++ b/AMWD.Common.EntityFrameworkCore/Extensions/ModelConfigurationBuilderExtensions.cs @@ -1,6 +1,4 @@ -#if NET6_0_OR_GREATER - -using System; +using System; using AMWD.Common.EntityFrameworkCore.Converters; using Microsoft.EntityFrameworkCore; @@ -39,5 +37,3 @@ namespace AMWD.Common.EntityFrameworkCore.Extensions } } } - -#endif diff --git a/AMWD.Common.Moq/AMWD.Common.Moq.csproj b/AMWD.Common.Moq/AMWD.Common.Moq.csproj index 9f28ded..a57cd5d 100644 --- a/AMWD.Common.Moq/AMWD.Common.Moq.csproj +++ b/AMWD.Common.Moq/AMWD.Common.Moq.csproj @@ -30,10 +30,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/AMWD.Common/AMWD.Common.csproj b/AMWD.Common/AMWD.Common.csproj index 333d45a..07eca69 100644 --- a/AMWD.Common/AMWD.Common.csproj +++ b/AMWD.Common/AMWD.Common.csproj @@ -29,14 +29,10 @@ - + - + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/AMWD.Common/Extensions/StreamExtensions.cs b/AMWD.Common/Extensions/StreamExtensions.cs index 0b8c0a2..c56409e 100644 --- a/AMWD.Common/Extensions/StreamExtensions.cs +++ b/AMWD.Common/Extensions/StreamExtensions.cs @@ -20,11 +20,8 @@ namespace System.IO /// public static string ReadLine(this Stream stream, Encoding encoding = null, char? eol = null) { - if (encoding == null) - encoding = Encoding.Default; - - if (eol == null) - eol = Environment.NewLine.Last(); + encoding ??= Encoding.Default; + eol ??= Environment.NewLine.Last(); if (!stream.CanRead) return null; @@ -56,11 +53,8 @@ namespace System.IO /// public static async Task ReadLineAsync(this Stream stream, Encoding encoding = null, char? eol = null, CancellationToken cancellationToken = default) { - if (encoding == null) - encoding = Encoding.Default; - - if (eol == null) - eol = Environment.NewLine.Last(); + encoding ??= Encoding.Default; + eol ??= Environment.NewLine.Last(); if (!stream.CanRead) return null; diff --git a/Directory.Build.props b/Directory.Build.props index e903063..325a8a7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -22,4 +22,11 @@ © {copyright:2020-} AM.WD MIT + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 26dc979..1c14201 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -9,16 +9,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - + + +