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.
21 lines
464 B
21 lines
464 B
2 years ago
|
using Autofac;
|
||
|
using FluentValidation;
|
||
|
using Recyclarr.Common.Extensions;
|
||
|
|
||
|
namespace Recyclarr.Common.FluentValidation;
|
||
|
|
||
|
public class ValidatorFactory : IValidatorFactory
|
||
|
{
|
||
|
private readonly ILifetimeScope _scope;
|
||
|
|
||
|
public ValidatorFactory(ILifetimeScope scope)
|
||
|
{
|
||
|
_scope = scope;
|
||
|
}
|
||
|
|
||
|
public IValidator GetValidator(Type typeToValidate)
|
||
|
{
|
||
|
return (IValidator) _scope.ResolveGeneric(typeof(IValidator<>), typeToValidate);
|
||
|
}
|
||
|
}
|