Skip to content

Instantly share code, notes, and snippets.

@JeremySkinner
Created January 9, 2010 11:21
Show Gist options
  • Select an option

  • Save JeremySkinner/272861 to your computer and use it in GitHub Desktop.

Select an option

Save JeremySkinner/272861 to your computer and use it in GitHub Desktop.
//Using autofac
[Test]
public void Creates_dependencies() {
var builder = new ContainerBuilder();
builder.RegisterModule(new AppModule());
var container = builder.Build();
var types = from type in typeof(HomeController).Assembly.GetExportedTypes()
where typeof(Controller).IsAssignableFrom(type) && !type.IsAbstract
select type;
foreach(var type in types) {
container.Resolve(type);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment