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/FluentValidation/ValidatorFactory.cs

21 lines
464 B

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);
}
}