Say I have this:
public class Human : SentientLifeForm, IHuman {
IBreathingService breathingService = null;
public Human(IBreathingService breathingService) {
this.breathingService = breathingService
}
}
public class Martian : SentientLifeForm, IMartian {
IBreathingService breathingService = null;
public Martian(IBreathingService breathingService) {
this.breathingService = breathingService
}
}
Then I have two different implementations of the BreathingService...
public class HumanBreathingService { ... }
public class MartianBreathingService { ... }
How can I use DI to pass the correct service implementation to the associated object? Or do I have to specify an IHumanBreathingService and an IMartianBreathingService?