You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bartelink edited this page Mar 28, 2013
·
3 revisions
The Extension also provides a more direct facility to achieve the effect accomplished via ContextPreservingGet; if you have a service with multiple interfaces you can use BindInterfaceToBinding as follows:
public class Service : IServiceA, IServiceB {}
Bind<Service>().ToSelf().InSingletonScope();
BindInterfaceToBinding<IServiceA, Service>();
BindInterfaceToBinding<IServiceB, Service>();
Using the Version 3 Bind overloads
In Ninject Version 3 and later, one can also achieve the same effect using:
public class Service : IServiceA, IServiceB {}
Bind<IServiceA,IServiceB,Service>().To<Service>().InSingletonScope();