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.TrashLib/Json/JsonAutofacModule.cs

23 lines
798 B

using Autofac;
using Newtonsoft.Json;
namespace Recyclarr.TrashLib.Json;
public class JsonAutofacModule : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
builder.Register<Func<JsonSerializerSettings, IBulkJsonLoader>>(c =>
{
return settings => new BulkJsonLoader(c.Resolve<ILogger>(), settings);
});
// Decorators for BulkJsonLoader. We do not use RegisterDecorator() here for these reasons:
// - We consume the BulkJsonLoader as a delegate factory, not by instance
// - We do not want all implementations of BulkJsonLoader to be decorated, only a specific implementation.
builder.RegisterType<GuideJsonLoader>();
builder.RegisterType<ServiceJsonLoader>();
}
}