Having read and googled to the point of exhaustion, I feel as though I may need some guidance.
This may partly be because of the introduction of Castle Windsor 3.0, however most of the blog posts, SO questions and other documentation is explicitly dependant on what I can see is now deprecated code.
So: The problem?
In my application, which is a WCF Service providing back end code to an MVC3 application, I have multiple layers, one of which provides virus scanning services for a file upload system.
The client has asked for support for multiple scan services, naturally I have complied and each scan service implements an IScanService interface, thusly:
public interface IScanService
{
void Execute();
ScanResult GetResult();
}
So in the WCf service, where the constructor may look like:
public McAfeeFileScanService(IScanService mcAfeeScanService)
{
_scanService = scanService;
}
How can I specialise that the IScanService which is injected is of implementation type McAfeeScanService, or NortonScanService or other implementation?
AFAIK Windsor by default would provide the first registered implementation, whether that is of type McAfeeScanService or not.
I was looking into ServiceOverrides, however that seems to have been deprecated in Windsor 3.0 in favour of the DependsOn(Dependency.OnComponenent()) [but I have failed to find any relevant examples] Ive also looked into Typed Factory Facilities, and into IHandlerSelector, but feel that some guidance is needed for this (seemingly common and probably simple) task.
Thanks all.