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;
@ -27,3 +28,4 @@ public static class ConfigurationExtension
: configuration.GetSection(key).Get<T>())
?? new T();
}
#endif

View File

@ -1,4 +1,5 @@
namespace DigitalData.Core.Abstractions;
#if NET
namespace DigitalData.Core.Abstractions;
/// <summary>
/// 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);
}
}
#endif

View File

@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net462;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- NuGet Package Metadata -->
<PackageId>DigitalData.Core.Abstractions</PackageId>
<Authors>Digital Data GmbH</Authors>
@ -17,9 +16,24 @@
<RepositoryUrl>http://git.dd:3000/AppStd/WebCoreModules.git</RepositoryUrl>
<PackAsTool>False</PackAsTool>
<PackageIcon>core_icon.png</PackageIcon>
<Version>4.1.0</Version>
<AssemblyVersion>4.1.0</AssemblyVersion>
<FileVersion>4.1.0</FileVersion>
<Version>4.1.1</Version>
<AssemblyVersion>4.1.1</AssemblyVersion>
<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>
<ItemGroup>

View File

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

View File

@ -1,8 +1,17 @@
namespace DigitalData.Core.Abstractions.Interfaces;
namespace DigitalData.Core.Abstractions.Interfaces
#if NET
;
#elif NETFRAMEWORK
{
#endif
/// <summary>
/// Ensures that extension methods are handled securely
/// </summary>
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;
namespace DigitalData.Core.Abstractions;
@ -29,3 +30,4 @@ public static class ServiceProviderExtensions
public static TOptions GetRequiredOptions<TOptions>(this IServiceProvider service) where TOptions : class
=> service.GetRequiredService<IOptions<TOptions>>().Value;
}
#endif