weikio/PluginFramework

Support for finding types which could implement interface

mikoskinen opened this issue · 0 comments

Background

The typefinder can currently find types which implement an interface.

But in some scenarios it would be great if we could find types which satisfy the interface without implementing it.

Solution ideas

There's at least couple ways to implement this:

  1. Add a new criteria to TypeFinderCriteria, something like "Type CanImplement".
  2. Alternatively provide a way through TypeFinderCriteria for describing the requirements for the the type. The requirements could be like: "Type has to have method which takes string and int as parameters and returns y" or "Type has to have a constructor which accepts ILogger". Multiple requirements should be supported.

Maybe at this point we could separate TypeFinder into a separate Nuget package?

Also, should we enable ducktaping for the found types at this point? Maybe wrap the types which could implement an interface with a new class that actually implements the interface and use that as a proxy. Not sure about this one. We could perhaps use something like Impromptu for handling the ducktaping.