Closed OmiCron07 closed 1 year ago
When using the extension method to register the validators:
builder.Services.AddFluentValidation(new[] { assembly });
It misses the parameter includeInternalTypes for services.AddValidatorsFromAssemblies
includeInternalTypes
services.AddValidatorsFromAssemblies
public static class ServiceCollectionExtensions { public static IServiceCollection AddFluentValidation(this IServiceCollection services, IEnumerable<Assembly> assemblies, ServiceLifetime lifetime = ServiceLifetime.Transient, Func<AssemblyScanner.AssemblyScanResult, bool>? filter = null, bool includeInternalTypes = false) { services.Add(new ServiceDescriptor(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>), lifetime)); services.AddValidatorsFromAssemblies(assemblies, lifetime, filter, includeInternalTypes); return services; } }
Good point, added in https://github.com/GetoXs/MediatR.Extensions.FluentValidation.AspNetCore/releases/tag/5.1.0
When using the extension method to register the validators:
builder.Services.AddFluentValidation(new[] { assembly });
It misses the parameter
includeInternalTypes
forservices.AddValidatorsFromAssemblies