refactor(Core.Abstractions): update to support net 4.6.2

This commit is contained in:
tekh 2025-09-15 10:16:28 +02:00
parent b99ff91841
commit c95f018413
6 changed files with 50 additions and 12 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.Configuration; #if NET
using Microsoft.Extensions.Configuration;
namespace DigitalData.Core.Abstractions; namespace DigitalData.Core.Abstractions;
@ -27,3 +28,4 @@ public static class ConfigurationExtension
: configuration.GetSection(key).Get<T>()) : configuration.GetSection(key).Get<T>())
?? new T(); ?? new T();
} }
#endif

View File

@ -1,4 +1,5 @@
namespace DigitalData.Core.Abstractions; #if NET
namespace DigitalData.Core.Abstractions;
/// <summary> /// <summary>
/// A deferred implementation of <see cref="IServiceProvider"/> that allows the <see cref="IServiceProvider"/> instance /// A deferred implementation of <see cref="IServiceProvider"/> that allows the <see cref="IServiceProvider"/> instance
@ -38,3 +39,4 @@ public class DeferredServiceProvider : IServiceProvider
return _serviceProvider.Value.GetService(serviceType); return _serviceProvider.Value.GetService(serviceType);
} }
} }
#endif

View File

@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks> <TargetFrameworks>net462;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- NuGet Package Metadata --> <!-- NuGet Package Metadata -->
<PackageId>DigitalData.Core.Abstractions</PackageId> <PackageId>DigitalData.Core.Abstractions</PackageId>
<Authors>Digital Data GmbH</Authors> <Authors>Digital Data GmbH</Authors>
@ -17,9 +16,24 @@
<RepositoryUrl>http://git.dd:3000/AppStd/WebCoreModules.git</RepositoryUrl> <RepositoryUrl>http://git.dd:3000/AppStd/WebCoreModules.git</RepositoryUrl>
<PackAsTool>False</PackAsTool> <PackAsTool>False</PackAsTool>
<PackageIcon>core_icon.png</PackageIcon> <PackageIcon>core_icon.png</PackageIcon>
<Version>4.1.0</Version> <Version>4.1.1</Version>
<AssemblyVersion>4.1.0</AssemblyVersion> <AssemblyVersion>4.1.1</AssemblyVersion>
<FileVersion>4.1.0</FileVersion> <FileVersion>4.1.1</FileVersion>
</PropertyGroup>
<!-- disable for net462 -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
<Nullable>disable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<!-- enable for net7 and more -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net7.0' Or '$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'net9.0'">
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,4 +1,9 @@
namespace DigitalData.Core.Abstractions.Interfaces; namespace DigitalData.Core.Abstractions.Interfaces
#if NET
;
#elif NETFRAMEWORK
{
#endif
/// <summary> /// <summary>
/// Ensures that extension methods are handled securely /// Ensures that extension methods are handled securely
@ -7,3 +12,7 @@
public interface IDto<Entity> where Entity : IEntity public interface IDto<Entity> where Entity : IEntity
{ {
} }
#if NETFRAMEWORK
}
#endif

View File

@ -1,4 +1,9 @@
namespace DigitalData.Core.Abstractions.Interfaces; namespace DigitalData.Core.Abstractions.Interfaces
#if NET
;
#elif NETFRAMEWORK
{
#endif
/// <summary> /// <summary>
/// Ensures that extension methods are handled securely /// Ensures that extension methods are handled securely
@ -6,3 +11,7 @@
public interface IEntity public interface IEntity
{ {
} }
#if NETFRAMEWORK
}
#endif

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection; #if NET
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
namespace DigitalData.Core.Abstractions; namespace DigitalData.Core.Abstractions;
@ -29,3 +30,4 @@ public static class ServiceProviderExtensions
public static TOptions GetRequiredOptions<TOptions>(this IServiceProvider service) where TOptions : class public static TOptions GetRequiredOptions<TOptions>(this IServiceProvider service) where TOptions : class
=> service.GetRequiredService<IOptions<TOptions>>().Value; => service.GetRequiredService<IOptions<TOptions>>().Value;
} }
#endif