Created
July 9, 2012 13:17
-
-
Save daanl/3076514 to your computer and use it in GitHub Desktop.
Ninject multiple classes one interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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