Files
modernkeepass/ModernKeePass.Infrastructure/DependencyInjection.cs
Geoffroy BONNEVILLE f208e2d0b6 Correct package version installed
Dependency injection works
Project renaming
WIP replacement of services with CQRS
2020-03-24 17:31:34 +01:00

27 lines
1.2 KiB
C#

using System.Reflection;
using AutoMapper;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Infrastructure.KeePass;
using ModernKeePass.Infrastructure.UWP;
namespace ModernKeePass.Infrastructure
{
public static class DependencyInjection
{
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
{
var assembly = typeof(DependencyInjection).GetTypeInfo().Assembly;
services.AddAutoMapper(assembly);
services.AddSingleton(typeof(IDatabaseProxy), typeof(KeePassDatabaseClient));
services.AddTransient(typeof(ICryptographyClient), typeof(KeePassCryptographyClient));
services.AddTransient(typeof(IPasswordProxy), typeof(KeePassPasswordClient));
services.AddTransient(typeof(IResourceProxy), typeof(UwpResourceClient));
services.AddTransient(typeof(ISettingsProxy), typeof(UwpSettingsClient));
services.AddTransient(typeof(IRecentProxy), typeof(UwpRecentFilesClient));
services.AddTransient(typeof(IFileProxy), typeof(StorageFileClient));
return services;
}
}
}