using Autofac; using FluentValidation; using Recyclarr.TrashLib.Config.Listers; using Recyclarr.TrashLib.Config.Parsing; using Recyclarr.TrashLib.Config.Secrets; using Recyclarr.TrashLib.Config.Services; using Recyclarr.TrashLib.Config.Yaml; using Recyclarr.TrashLib.Settings; using YamlDotNet.Serialization; using YamlDotNet.Serialization.ObjectFactories; namespace Recyclarr.TrashLib.Config; public class ConfigAutofacModule : Module { protected override void Load(ContainerBuilder builder) { builder.RegisterAssemblyTypes(ThisAssembly) .AsClosedTypesOf(typeof(IValidator<>)) .As(); builder.RegisterAssemblyTypes(ThisAssembly) .AssignableTo() .As(); builder.RegisterType().As().SingleInstance(); builder.RegisterType().As().SingleInstance(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType(); builder.RegisterType(); builder.RegisterType(); // Config Listers builder.RegisterType().Keyed(ConfigCategory.Templates); builder.RegisterType().Keyed(ConfigCategory.Local); } }