You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.Common/CommonAutofacModule.cs

27 lines
709 B

using System.Reflection;
using Autofac;
using Recyclarr.Common.FluentValidation;
using Module = Autofac.Module;
namespace Recyclarr.Common;
public class CommonAutofacModule : Module
{
private readonly Assembly _rootAssembly;
public CommonAutofacModule(Assembly rootAssembly)
{
_rootAssembly = rootAssembly;
}
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<DefaultEnvironment>().As<IEnvironment>();
builder.RegisterType<FileUtilities>().As<IFileUtilities>();
builder.RegisterType<ValidatorFactory>();
builder.Register(_ => new ResourceDataReader(_rootAssembly))
.As<IResourceDataReader>();
}
}