How to programmatically register a component that depends on a list of already registered components

Posted by Chris Carter on Stack Overflow See other posts from Stack Overflow or by Chris Carter
Published on 2010-01-14T23:53:02Z Indexed on 2010/03/31 16:03 UTC
Read the original article Hit count: 178

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about castle-windsor

Related posts about ioc-container