Sunday, June 7, 2009

Easy component registration for Windsor Container

If you are tired of forests of declarations for WindsorContainer you might find this do a trick for you:
var container = new WindsorContainer();
container.Register(AllTypes.Pick()
.FromAssembly(Assembly.GetExecutingAssembly())
.WithService
.FirstInterface());
This piece of code will search all types within running assembly and register them in container.

No comments:

Post a Comment