fix: CryptFactory.Instance in Getter-Methode für träges Laden umwandeln

This commit is contained in:
Developer 02 2024-11-19 13:32:38 +01:00
parent 6ce4a08c53
commit ed36015d1e
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using DigitalData.Core.Abstractions.Security;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace DigitalData.Core.Security
@ -7,7 +8,7 @@ namespace DigitalData.Core.Security
{
public static IServiceCollection AddSecurity(this IServiceCollection services)
{
services.TryAddScoped(_ => CryptFactory.Static);
services.TryAddScoped<ICryptFactory>(_ => CryptFactory.Instance);
return services;
}