I have multiple components implementing IPollingService interface and i'd like to register them all by convention. By the way i don't see any component registered in the container and i cannot seem to resolve them. Any idea?
I tried the following but i cannot resolve them:
public class PollingServicesInstaller : IWindsorInstaller
{
public void Install( IWindsorContainer container, IConfigurationStore store )
{
var registrations = Classes.FromThisAssembly()
.BasedOn<IPollingService>().WithServiceBase().AllowMultipleMatches();
container.Register( registrations );
}
}
static void Main( string[] args )
{
var container = new Castle.Windsor.WindsorContainer();
container.Install( new PollingServicesInstaller() );
var pollingServices = container.ResolveAll<IPollingService>();
//pollingServices is empty at this point but i got several implementations in this assembly
}
public class ServiceMock1 : IPollingService
{
public int PollingInterval { get; set; }
public bool Enabled { get; set; }
public ServiceMock1()
{
this.PollingInterval = 3000;
}
public void Run()
{
Console.WriteLine( Thread.CurrentThread.ManagedThreadId );
Console.WriteLine( "doing stuff " + this.PollingInterval );
}
}
As you can see from the screenshot 0 implementations are loaded.

I also noticed that CastleWindsor do not find my installer if i try to run installers this way:
container.Install( FromAssembly.This() );
IPollingServiceimplementations not public? Could you post one that you would expect to be resolved? - Patrick Quirk