Here I send you a patch with a test for this behaviour.
Regards.

On Fri, Nov 14, 2008 at 12:24 PM, Germán Schuager <[EMAIL PROTECTED]>wrote:

> Ok, no problem, it just seemed a little counter-intuitive (to me) that
> Resolve<T> uses GetHandler and ResolveAll<T> uses GetAssignableHandlers.
>
> Thanks again.
>
>
> On Fri, Nov 14, 2008 at 11:17 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
>
>> Looking at the patch, I now have about what you are talking about.
>>
>> I am afraid that this is the expected behavior for ResolveAll, You get all
>> the components whose _service_ is assignable to the service you resolve.
>> I mistakenly assumed that you were talking about a case where you seen
>> that in the impl.
>>
>> To solve your original problem, you would need to modify the ArrayResolver
>> to only use matching handlers, not assignable handlers.
>>
>> On Mon, Nov 3, 2008 at 6:09 PM, Germán Schuager <[EMAIL PROTECTED]>wrote:
>>
>>>
>>> Hi,
>>>
>>> I'm using the ArrayResolver that Hammet proposed here
>>> http://hammett.castleproject.org/?p=257.
>>>
>>> Also, I'm registering IValidatorRunner (from
>>> Castle.Components.Validator) in the container in this way:
>>>
>>>   container.Register(
>>>
>>>
>>> Component.For<IValidatorRegistry>().ImplementedBy<CachedValidationRegistry>(),
>>>
>>>
>>> Component.For<IValidatorRunner>().ImplementedBy<ValidatorRunner>().LifeStyle.Transient
>>>   )
>>>
>>> Besides this, I've some others components registered that implements
>>> IValidationContributor (but are not registered with this service)
>>>
>>>
>>> The problem that I'm facing is that when an IValidatorRunner is being
>>> resolved, the ArrayResolver tries to get every IValidationContributor
>>> from the container in order to use the constructor with the following
>>> signature:
>>>
>>>   public ValidatorRunner(IValidationContributor[] contributors,
>>> IValidatorRegistry registry)
>>>
>>> but I don't really want this behaviour.
>>> Instead, I just want it to be resolved using the constructor with this
>>> other signature:
>>>
>>>   public ValidatorRunner(IValidatorRegistry registry)
>>>
>>>
>>> Questions:
>>> 1. Is that Ok that ResolveAll returns components that implement
>>> IValidationContributor but that are not registered using that service?
>>> 2. Is there any way to specify my requirement when registering
>>> IValidatorRunner?
>>>
>>>
>>>
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Attachment: resolvealltest.patch
Description: Binary data

Reply via email to