What is the NInject equivalent of the following code that uses Autofac:
var builder = new ContainerBuilder();
System.Reflection.Assembly assembly = ...;
builder.RegisterAssemblyTypes(assembly).AsClosedTypesOf(typeof(OpenGeneric<>))
.As<IAnInterface>();
var resolved = container.Resolve<IEnumerable<IAnInterface>>();
Using Ninject 3.0.0-rc3 you can use
Depending on your requirements you can probably remove the
WhichAreGenericstatement..SelectAllClasses().InheritedFrom(typeof(BaseService<>)).WhichAreGeneric()selects the classes to which a binding is created.Conventions ensures that the interface and the implementation class must have the same open type arguments. E.g. In case
IBar<T1, T2>is the only valid interface forBar<T1, T2>. But for Foo bothIBar<int, int>, IFooare valid.