fix: provide validators that Autofac is not handling well

This commit is contained in:
Dylan R. E. Moonfire 2022-06-06 21:46:31 -05:00
parent e913818e6f
commit 698e918836
4 changed files with 12 additions and 8 deletions

View file

@ -23,9 +23,10 @@ public class ApplyStyleTemplate<TModel> : OperationBase
private readonly IValidator<ApplyStyleTemplate<TModel>> validator;
public ApplyStyleTemplate(IValidator<ApplyStyleTemplate<TModel>> validator, HandlebarsTemplateCache cache)
public ApplyStyleTemplate(HandlebarsTemplateCache cache)
{
this.validator = validator;
// TODO: Figure out why Autofac won't let us register IValidator of generic classes.
this.validator = new ApplyStyleTemplateValidator<TModel>();
this.cache = cache;
}

View file

@ -24,9 +24,10 @@ public class RenderContentTemplate<TModel> : OperationBase
private readonly IValidator<RenderContentTemplate<TModel>> validator;
public RenderContentTemplate(IValidator<RenderContentTemplate<TModel>> validator, HandlebarsTemplateCache cache)
public RenderContentTemplate(HandlebarsTemplateCache cache)
{
this.validator = validator;
// TODO: Figure out why Autofac won't let us register IValidator of generic classes.
this.validator = new RenderContentTemplateValidator<TModel>();
this.cache = cache;
}

View file

@ -19,9 +19,10 @@ public class SetInstantFromComponent<TComponent> : OperationBase
private readonly IValidator<SetInstantFromComponent<TComponent>> validator;
public SetInstantFromComponent(IValidator<SetInstantFromComponent<TComponent>> validator, Timekeeper clock)
public SetInstantFromComponent(Timekeeper clock)
{
this.validator = validator;
// TODO: Figure out why Autofac won't let us register IValidator of generic classes.
this.validator = new SetInstantFromComponentValidator<TComponent>();
this.clock = clock;
}

View file

@ -25,9 +25,10 @@ public class CreateIndexEntities<TIndexKey> : OperationBase
private readonly IValidator<CreateIndexEntities<TIndexKey>> validator;
public CreateIndexEntities(ILogger logger, IValidator<CreateIndexEntities<TIndexKey>> validator)
public CreateIndexEntities(ILogger logger)
{
this.validator = validator;
// TODO: Figure out why Autofac won't let us register IValidator of generic classes.
this.validator = new CreateIndexEntitiesValidator<TIndexKey>();
this.logger = logger.ForContext(typeof(CreateIndexEntities<>));
}