I understand that AsImplementedInterfaces() registers all implemented interfaces, however this is sometimes too much. Take for instance, the FluentValidation library, you may scan with the following:
.AddClasses(c => c.AssignableTo(typeof(IValidator<>))).AsImplementedInterfaces()
This will pickup all the AbstractValidator<T> implementations you have, but this class implements the following interfaces:
IValidator<T>
IEnumerable
IEnumerable<IValidationRule>
IValidator
Which means you get entries for all of these, not just the desired IValidator<T> and I need to do the following to get rid of the superfluous entries:
services.RemoveAll<IValidator>();
services.RemoveAll<IEnumerable>();
services.RemoveAll<IEnumerable<IValidationRule>>();
Is there any way to do this without having to remove the extra entries afterwards?
I understand that AsImplementedInterfaces() registers all implemented interfaces, however this is sometimes too much. Take for instance, the FluentValidation library, you may scan with the following:
.AddClasses(c => c.AssignableTo(typeof(IValidator<>))).AsImplementedInterfaces()This will pickup all the
AbstractValidator<T>implementations you have, but this class implements the following interfaces:Which means you get entries for all of these, not just the desired
IValidator<T>and I need to do the following to get rid of the superfluous entries:Is there any way to do this without having to remove the extra entries afterwards?