Filip,

as of v2.5 currently there's no way to intercept the call to ResolveAll the way you describe.

This has been already implemented for the next version though: http://issues.castleproject.org/issue/IOC-268

As of now the first thing that comes to mind is that your operations look like startable components, so you might pretty easily write a custom facility that listens to the registration, records the information about overrides and then uses this information to resolve just the right ones, one by one.

HTH,
Krzysztof



On 25/01/2011 2:09 AM, Filip Kinsky wrote:
I have a modular application which works basically in two steps:

1. registers all operations from all available application modules:


container.Register(AllTypes.FromAssemblyInDirectory(dir).BasedOn<IMyOperation>().WithService.Select(new[]
{typeof(IMyOperation)}))

2. executes all registered operations

    container.ResolveAll<IMyOperation>().ForEach(op =>  op.Execute())

This works just fine, but I need to add ability to override some
default operations in "core" module with some other operations from
other modules. I was thinking about using attributes for marking
operation classes with should override some other default operations
like this:

class DefaultOperation: IMyOperation{}

[OperationOverride(typeof(DefaultOperation))]
class OtherOperation: DefaultOperation{}

and than applying my own IHandlerSelector implementation (or something
like this) which should resolve just operations which are not
overridden. Unfortunately IHandlerSelector.SelectHandler does not
allow to return array of IHandler, but just single IHandler which
makes this idea impossible. Is there any other Windsor extension point
I could use to make this kind of filtering? Or does anybody have an
idea how to achieve this concept? I'd prefer some Windsor-based
solution. I can always make something like
container.ResolveAll<IMyOperation>().Where(is_not_overriden), but I
don't like this approach...


--
You received this message because you are subscribed to the Google Groups "Castle 
Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to