2020-03-30 19:43:04 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-03-24 13:01:14 +01:00
|
|
|
|
using ModernKeePass.Application.Common.Interfaces;
|
2020-03-28 16:13:17 +01:00
|
|
|
|
using ModernKeePass.Domain.Interfaces;
|
|
|
|
|
using ModernKeePass.Infrastructure.Common;
|
2020-03-24 13:01:14 +01:00
|
|
|
|
using ModernKeePass.Infrastructure.KeePass;
|
|
|
|
|
using ModernKeePass.Infrastructure.UWP;
|
|
|
|
|
|
|
|
|
|
namespace ModernKeePass.Infrastructure
|
|
|
|
|
{
|
2020-03-24 17:31:34 +01:00
|
|
|
|
public static class DependencyInjection
|
2020-03-24 13:01:14 +01:00
|
|
|
|
{
|
2020-04-06 20:20:45 +02:00
|
|
|
|
public static IServiceCollection AddInfrastructureCommon(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddTransient(typeof(IDateTime), typeof(MachineDateTime));
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddInfrastructureKeePass(this IServiceCollection services)
|
2020-03-24 13:01:14 +01:00
|
|
|
|
{
|
2020-03-24 17:31:34 +01:00
|
|
|
|
services.AddSingleton(typeof(IDatabaseProxy), typeof(KeePassDatabaseClient));
|
|
|
|
|
services.AddTransient(typeof(ICryptographyClient), typeof(KeePassCryptographyClient));
|
|
|
|
|
services.AddTransient(typeof(IPasswordProxy), typeof(KeePassPasswordClient));
|
2020-04-06 20:20:45 +02:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddInfrastructureUwp(this IServiceCollection services)
|
|
|
|
|
{
|
2020-03-28 16:13:17 +01:00
|
|
|
|
services.AddScoped(typeof(IFileProxy), typeof(StorageFileClient));
|
2020-04-06 20:20:45 +02:00
|
|
|
|
services.AddTransient(typeof(ISettingsProxy), typeof(UwpSettingsClient));
|
|
|
|
|
services.AddTransient(typeof(IRecentProxy), typeof(UwpRecentFilesClient));
|
2020-03-24 17:31:34 +01:00
|
|
|
|
return services;
|
2020-03-24 13:01:14 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|