Reputation: 679
I have an interface implemented by two different classes. Then, how can I say to Ninject that I want to bind it to implementation A in some assembly and to implementation B in some other assembly ?
Upvotes: 4
Views: 1014
Reputation: 66783
You can use contextual binding:
Bind<IFoo>.To<Foo>.When(request =>
request.Target.Type.Assembly.FullName == "someAssembly");
Bind<IFoo>.To<Bar>.When(request =>
request.Target.Type.Assembly.FullName == "someOtherAssembly");
Upvotes: 5