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));
|
2020-05-14 12:05:05 +02:00
|
|
|
|
services.AddTransient(typeof(IDatabaseSettingsProxy), typeof(KeePassDatabaseSettingsProxy));
|
2020-04-20 20:02:43 +02:00
|
|
|
|
services.AddTransient(typeof(ICredentialsProxy), typeof(KeePassCredentialsClient));
|
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-04-17 16:56:07 +02:00
|
|
|
|
services.AddTransient(typeof(IResourceProxy), typeof(UwpResourceClient));
|
2020-05-14 12:05:05 +02:00
|
|
|
|
services.AddTransient(typeof(ICryptographyClient), typeof(UwpCryptographyClient));
|
2020-04-22 18:12:28 +02:00
|
|
|
|
services.AddTransient(typeof(INotificationService), typeof(ToastNotificationService));
|
2020-03-24 17:31:34 +01:00
|
|
|
|
return services;
|
2020-03-24 13:01:14 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|