Alexander:
In order to do this, you'll have to add another hint to the parameters in order to guide Ninject. You can do this one of two ways: first, you can use the [Tag] attribute to mark the different dependencies:
public Configuration(
[Tag("remote")] IConfigurationService remoteConfigurationService,
[Tag("local")] IConfigurationService localConfigurationService)
{ ... }
Then your bindings would look like this:
Bind<IConfigurationService>().To<RemoteConfigurationService>().Only(When.Context.Target.Tag == "remote");
Bind<IConfigurationService>().To<LocalConfigurationService>().Only(When.Context.Target.Tag == "local");
However, relying on string-based identifiers can be error-prone, so I would suggest creating attributes instead:
public class RemoteAttribute : Attribute {}
public class LocalAttribute : Attribute {}
Then your constructor would look like this:
public Configuration(
[Remote] IConfigurationService removeConfigurationService,
[Local] IConfigurationService localConfigurationService)
{ ... }
And your bindings would look like this:
Bind<IConfigurationService>().To<RemoteConfigurationService>().WhereTargetHas<RemoteAttribute>();
Bind<IConfigurationService>().To<LocalConfigurationService>().WhereTargetHas<LocalAttribute>();
If you don't want to use attributes, you can make it work by getting more creative with your bindings:
Bind<IConfigurationService>().To<RemoteConfigurationService>().Only(
When.Context.Target.Name == "remoteConfigurationService");
Bind<IConfigurationService>().To<LocalConfigurationService>().Only(
When.Context.Target.Name == "localConfigurationService"):
These bindings will work with your constructor as-is, but bear in mind that if you want an instance of RemoteConfigurationService, you will always have to name the argument "remoteConfigurationService", and if you want an instance of LocalConfigurationService, the argument will have to be called "localConfigurationService".
If this isn't clear, just ask, and I'll do my best to explain it a little better. :)
Thanks,
Nate