I see Simple Injector's Container has this method
public void RegisterConditional<TService, TImplementation>(
Predicate<PredicateContext> predicate
)
But I want to use the different object of the same implementation for different service, so what overloaded method I need would look like this
public void RegisterConditional<TService>(
Func<TService> instanceCreator,
Predicate<PredicateContext> predicate
)
But the SimpleInjector doesn't have it. I am trying to find the other Container's methods to register instance creator with condition for the service. Is there the other ways else I can do?
Or, is what I am trying to do not the good design, so the developers don't implement it?
Edited: Added example and the more detailed question.
Example
class CSVFileScanner
{
public CSVFileScanner(IFileLocator fileLocator) { }
}
class XMLFileScanner
{
public XMLFileScanner(IFileLocator fileLocator) { }
}
class DefaultLogFileLocator: ILogFileLocator
{
public DefaultLogFileLocator(string directoryPath, string searchPattern) { }
}
var locatorForCSVFileScanner = new DefaultLogFileLocator("C:\CSVLogDir", "*.csv")
var locatorForXMLFileScanner = new DefaultLogFileLocator("C:\XMLLogDir", "*.xml")
From the example source code, how can I register them to get locatorForCSVFileScanner object passed to the CSVFileScanner constructor when CSVFileScanner getting created and locatorForXMLFileScanner object passed to the XMLFileScanner constructor when XMLFileScanner getting created?