I am migrating from IIS WebAPI to OwinHost. Utilizing the latest pre-release versions of nuget packages, I successfully used instructions here:
https://github.com/ninje
In addition to Olif's post:
install-package ninject.extensions.conventions
In your startup class add: using Ninject.Extensions.Conventions;
Instead of manually binding:
public static IKernel CreateKernel() { var kernel = new StandardKernel(); //Create the bindings kernel.Bind
().To ProductRepository (); return kernel; }
You can now do:
kernel.Bind(x =>
{
x.FromThisAssembly()
.SelectAllClasses()
.BindDefaultInterface();
});
This will look through your assembly, and do the binding automatically.