I know I can specify it in the configuration XML, but I'd like to not have to do so for every controller. For example: I have a controller without any dependencies being injected, but I'd rather not type out the XML component section in the config file or register it programmatically. Any ideas, suggestions, examples? Thanks for all the help!
views:
57answers:
1
+1
Q:
How to I make castle windsor automatically register controllers that don't have any dependencies?
+2
A:
This will automatically register all the controllers from the assembly of DependencyInjectionContainer class. No matter controllers have dependencies or not.
Register(
AllTypes.Of<IController>()
.FromAssembly(typeof(DependencyInjectionContainer).Assembly)
.Configure(c => c.LifeStyle.Transient)
);
Dmytrii Nagirniak
2009-11-26 00:22:43
Thank you that was exactly as simple as I had hoped it would be!
mkelley33
2009-11-26 00:31:12