piwigodotnet/PiwigoDotnet/Piwigo.Client.Autofac/PiwigoModule.cs
2022-10-25 21:58:26 +02:00

26 lines
954 B
C#

using Autofac;
namespace Piwigo.Client.Autofac;
public sealed class PiwigoModule : Module
{
private readonly IPiwigoConfiguration _configuration;
public PiwigoModule(IPiwigoConfiguration configuration)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
}
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.RegisterInstance(() => _configuration).AsImplementedInterfaces();
builder.RegisterType<PiwigoContext>().AsImplementedInterfaces().InstancePerLifetimeScope();
builder.RegisterType<AlbumApi>().AsImplementedInterfaces();
builder.RegisterType<ImageApi>().AsImplementedInterfaces();
builder.RegisterType<SessionApi>().AsImplementedInterfaces();
builder.RegisterType<TagApi>().AsImplementedInterfaces();
builder.RegisterType<PiwigoClient>().AsImplementedInterfaces();
}
}