When using auto-registration with castle windsor I see people doing things like
_container.Register(
AllTypes.Pick().FromAssembly(Assembly.GetExecutingAssembly())
.WithService.FirstInterface());
For the life of me I can't figure out what the Pick() method does nor can I find any documentation. Can anyone explain it to me?
Best Answer
Pick(IEnumerable<Type>)
is a synonym forFrom(IEnumerable<Type>)
, i.e. it selects the specified types as registration targets.AllTypes.Pick()
is the same asAllTypes.Of<object>()
, so it effectively selects all types.AllTypes.Pick().FromAssembly(Assembly.GetExecutingAssembly())
will select ALL types in the executing assembly (you can then filter, of course)As usual, take a look at the fluent API wiki and/or test case for more information.