GetoXs / MediatR.Extensions.FluentValidation.AspNetCore

MediatR extension to FluentValidation for .NET framework
MIT License
65 stars 6 forks source link

Missing the parameter "includeInternalTypes" #18

Closed OmiCron07 closed 1 year ago

OmiCron07 commented 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

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;
  }
}
GetoXs commented 1 year ago

Good point, added in https://github.com/GetoXs/MediatR.Extensions.FluentValidation.AspNetCore/releases/tag/5.1.0