I don't.
The way I have my application is the typical:
- Register explicitly, i.e.
Component.For<IFoo>().ImplementedBy<Foo>()..., for things that I need
explicit.
- Then, some convention based things. Like
Classes.Pick().BasedOn<Bar>().WithServiceBase().
- Finally, the "catch all", which is
Register(Classes.Pick().WithServiceSelf().WithServiceAllInterfaces()).
I have an infrastructure library which contains a bunch of helper classes,
some of which contain basic services that are required. As the
infrastructure library, it also will contain things that are not services,
like a ReadOnlyDictionary<,>, which is what caused the exception.
WithDefaultInterfaces() will not work since some classes are not a 1-to-1
implementation, and implement multiple service interfaces.
On Tuesday, July 10, 2012 10:39:07 PM UTC-4, Krzysztof Koźmic wrote:
>
> So leaving this example aside, the reason for this behavior is that
> Windsor sees you're registering your type as IEnumerable<SomeValueType>
> which while used to be allowed previously is not really something you'd
> want to have as a service.
>
> So can you help me better understand in your actual scenario why do you
> want to expose IEnumerable<SomeValueType> as a service off your component?
>
> thanks,
> @K
>
> On 11/07/12 8:28 AM, bling wrote:
>
> [Test]
> public void RegisterGenericType_WithServiceAllInterfaces()
> {
> Assert.DoesNotThrow(() =>
> Kernel.Register(Classes.From(typeof(Dictionary<,>)).Pick().WithServiceAllInterfaces()));
> }
>
> On Tuesday, July 10, 2012 6:10:57 PM UTC-4, Krzysztof Koźmic wrote:
>>
>> Thanks.
>>
>> Can you create an actual failing test?
>>
>> Thanks
>> @k
>> On Jul 11, 2012 8:09 AM, "bling" <[email protected]> wrote:
>>
>>> the following works with 3.0, but throws an exception in 3.1
>>>
>>> var c = new WindsorContainer();
>>>
>>> c.Register(Classes.From(typeof(Dictionary<,>)).Pick().WithServiceBase().WithServiceAllInterfaces());
>>>
>>> i'm not sure what the actual issue is, but exception message
>>> complained about ICollection<KeyValuePair<,>> so i took a guess and was
>>> able to reproduce. a class similar to that signature does exist in my
>>> actual code.
>>>
>>> thanks,
>>> bling
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Castle Project Users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/castle-project-users/-/M4VIrLskVH8J.
>>> 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.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/castle-project-users/-/f2QKPH2AibYJ.
> 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.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/castle-project-users/-/mSI1F8MzbNUJ.
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.