How to make Windsor lock automatically register controllers that don't have any dependencies?

I know that I can specify it in the XML configuration, but I would not want to do this for each controller. For example: I have a controller without any dependencies that were introduced, but I would not want to type the XML component section in the configuration file or register it programmatically. Any ideas, suggestions, examples? Thanks for the help!

+4
source share
1 answer

This will automatically register all the controllers from the assembly of the DependencyInjectionContainer class. Regardless of which controllers have dependencies or not.

Register( AllTypes.Of<IController>() .FromAssembly(typeof(DependencyInjectionContainer).Assembly) .Configure(c => c.LifeStyle.Transient) ); 
+6
source

All Articles