How to programmatically register a component that depends on a list of already registered components
- by Chris Carter
I'm programmatically registering a group of services that all implement the same interface, IRule. I have another service that looks like this:
public class MyService {
private IEnumerable<IRule> _rules;
public MyService(IEnumerable<IRule> rules){
_rules = rules;
}
}
Hammett posted something that looked like what I wanted, http://hammett.castleproject.org/?p=257. I changed the signature to IRule[] and tried the ArrayResolver trick in the post but that didn't work for me(note, it didn't break anything either).
Anyone know how to programmatically register a component like the code I posted above?