You can try Ninject.Extensions.Conventions :
var kernel = new StandardKernel(); kernel.Bind(c => c.FromThisAssembly() .SelectAllClasses().InheritedFrom<IFoo>() .BindAllInterfaces());
The required classes are below:
public interface IFoo { void DoSmth(); } public class Foo1 : IFoo { public void DoSmth() { Console.Out.WriteLine("Foo1"); } } public class Foo2 : IFoo { public void DoSmth() { Console.Out.WriteLine("Foo2"); } }
the_joric
source share