Hi guys,
Sorry if this is answered anywhere, but I've spent a good deal of time
trying to find information on the issue at hand and failed to do so.
I want to use Windsor to register a factory method that can be later
used with a runtime parameter to get a proper instance of an object.
Something like this:
enum EngineType{
One,
Two,
Three
}
interface IEngine {
bool Run();
}
class Factory{
IEngine ResolveEngine(EngineType engineType){
switch (engineType){
case EngineType.One:
return new EngineOne();
case EngineType.Two:
return new EngineTwo();
case EngineType.Three:
return new EngineThree();
}
}
}
So, my problem - is there any way to register Factory.ResolveEngine
method with Windsor, so I can do something like that in my code at the
time of execution:
EngineType eType = EngineType.Two;
var engine = container.Resolve<IEngine>(eType);
engine.Run();
Any help would be appreciated. Thanks in advance.
Alex
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.