How to determine if a component is allowed from an IHandlersFilter implementation

I am trying to write an implementation of Castle Windsor v3 IHandlersFilter that will filter out handlers that cannot be resolved. This is necessary to restore the old (pre-castle 3) behavior of ResolveAll ( How to restore the old CollectionResolver behavior to Castle 3? )

My question is: from the SelectHandlers method, in the best way (if any) to determine which of the input IHandlers are solvable? I experimented with the IHandler.CanResolve method, but it accepts parameters that are a bit more advanced than I usually do, so I'm not sure how to use the method correctly.

0
source share
1 answer

You can check handler.CurrentState == HandlerState.Valid

However, remember that this is based on what Windsor can determine statically, so the answer may not always be 100% accurate (for example, some components may have dynamic dependencies, so they will appear as insoluble here, but you can successfully solve them upon attempt).

+1
source

Source: https://habr.com/ru/post/1386753/


All Articles