Skip to content

AsImplementedInterfaces() registering too much #65

@danspam

Description

@danspam

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions