In my code I have a base type which is OnlinePaymentTransaction:
public abstract class OnlinePaymentTransaction
{
public abstract void Complete( PaymentGatewayCallbackArgs args );
}
The problem I am having is that each class that inherits from this base class require different dependency's in the complete method. Currently I have just added the dependency's as extra parameters to the complete method which doesn't seem right. For example my base class is now like this.
public abstract class OnlinePaymentTransaction
{
public abstract void Complete( Dependency1 dep1, Dependency2 dep2, PaymentGatewayCallbackArgs args );
}
I cannot inject the dependency's in the constructor as the OnlinePaymentTransactions are retrieved from using nhibernate.
What would you recommend because I don't like using ServiceLocator as it hides the dependency and also makes it harder to test. An suggestions would be greatly appreciated.