JeffreyABecker
JeffreyABecker

Reputation: 2743

How can I customize bindings in ninject

I'd like to 'any interface that inherits one or more interfaces from this list of interfaces' to a specific provider using ninject 2. Would an implementation of IBindingResolver be appropriate here?

Upvotes: 1

Views: 154

Answers (1)

Remo Gloor
Remo Gloor

Reputation: 32725

no - use ninject.extensions.conventions instead

kernel.Bind(
    x => x.FromThisAssembly()
          .SelectTypesInheritedFrom<IMyInterface>()
          .BindToAllInterfaces()
          .Configure((c, s) => c.InSingletonScope()));

Upvotes: 1

Related Questions