Can we get an AddInterfaces() comparable to AddClasses()
I wanted to use Scrutor to register all of my https://github.com/reactiveui/refit interfaces to RestService.For<T> however there doesn't seem to be any obvious ways to do this since I don't have any classes at all for these.
I'm not sure this is the right library for this. The library is designed in a specific way, which wouldn't match what you're trying to do here:
- Select assemblies to scan
- Find
ImplementationTypeusing theAddClassesmethod. - Select the
ServiceTypeusing one of theAs*methods. - Choose a lifetime using the
With*Lifetime.
I think what you want to do would be something like
- Select assemblies to scan
- Find
ServiceTypeusing anAddInterfacesmethod. - Specify an
ImplementationFactoryusing aUseFactorymethod. The factory would be something likeinterfaceType => provider => RestService.For(interfaceType). - Choose a lifetime using the
With*Lifetime.
As you can see, step 2. and 3. (service type and implementation type/factory selection) has been swapped, while the names of the methods follows the same conventions, which I think would be very confusing.
I'd really like this project to be able to end the need to ever write typeof(Foo).Assembly.GetTypes().Where().ForEach()...
I've already used it in many 'unsupported' manners by simply using return false to prevent any built in registration behavior from kicking in.
The only scenario I haven't been able to cover is for interface only scanning.