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.
24 lines
819 B
24 lines
819 B
1 year ago
|
using System.Text.Json;
|
||
1 year ago
|
using Autofac;
|
||
1 year ago
|
using Recyclarr.Json.Loading;
|
||
1 year ago
|
|
||
1 year ago
|
namespace Recyclarr.Json;
|
||
1 year ago
|
|
||
|
public class JsonAutofacModule : Module
|
||
|
{
|
||
|
protected override void Load(ContainerBuilder builder)
|
||
|
{
|
||
|
base.Load(builder);
|
||
1 year ago
|
builder.Register<Func<JsonSerializerOptions, IBulkJsonLoader>>(c =>
|
||
1 year ago
|
{
|
||
|
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>();
|
||
|
}
|
||
|
}
|