Skip to content

Instantly share code, notes, and snippets.

@daanl
Created July 9, 2012 13:17
Show Gist options
  • Save daanl/3076514 to your computer and use it in GitHub Desktop.
Save daanl/3076514 to your computer and use it in GitHub Desktop.
Ninject multiple classes one interface
kernel.Bind(
x => x.FromThisAssembly()
.SelectAllClasses().InheritedFrom<IGenre>()
.BindAllInterfaces()
);
public class TestController
{
public TestController(IEnumerable<IGenre> gernes)
{
var horror = genres.FirstOrDefault(x => x == typeof(Horror));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment