I was wondering if there is some best practice to provide dependencies to Abstract components.
Lets say I have Template Method algorithm like this:
public abstract class TemplateMethod
{
protected abstract void StepA();
protected abstract void StepB();
protected abstract void StepC();
public void Go()
{
StepA();
StepB();
CommonLogic();
StepC();
}
private CommonLogic()
{
myDependency.DoSomething();
}
}
I haven't managed to inject myDependecy to the class because the abstract TemplateMethod of course is never instantiated. I've managed to provide it with Service Location but I'm sure there is better way of doing this.
Any ideas?
PS Using Castle Windsor as IoC container.