piwigodotnet/PiwigoDotnet/Piwigo.Client.Autofac/PiwigoModule.cs

26 lines
954 B
C#
Raw Normal View History

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();
}
}