feat: DI-Erweiterung zur Registrierung von CryptFactory hinzugefügt

This commit is contained in:
Developer 02
2024-11-19 13:19:14 +01:00
parent 4c379c2d4d
commit 6ce4a08c53
3 changed files with 18 additions and 9 deletions

View File

@@ -6,6 +6,6 @@ namespace DigitalData.Core.Security
{
private static readonly Lazy<ICryptFactory> LazyStaticCryptFactory = new (() => new CryptFactory());
public ICryptFactory Static = LazyStaticCryptFactory.Value;
public static ICryptFactory Static = LazyStaticCryptFactory.Value;
}
}

View File

@@ -0,0 +1,15 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace DigitalData.Core.Security
{
public static class DIExtensions
{
public static IServiceCollection AddSecurity(this IServiceCollection services)
{
services.TryAddScoped(_ => CryptFactory.Static);
return services;
}
}
}