How do I change the Concrete class to inject using Ninject. So far I have a single interface for each concrete class. I now have two concrete classes for a single interface where one needs to be chosen over the other depending on the attribute/controller I'm injecting.
class IService {}
class ConcreteServiceA : IService {}
class ConcreteServiceB : IService {}
// Where the binding happens-
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<IService>().To<ConcreteServiceA>();
kernel.Bind<IService>().To<ConcreteServiceB>();
}
class ControllerA {
[Inject]
// Needs to be ConcreteServiceA
public IService _service { get; set; }
}
class ControllerB {
[Inject]
// Needs to be ConcreteServiceB
public IService _service { get; set; }
}