GetEnumerator() is a method :P, badly forced example aside, after digging through the code i see that the exception thrown is checking specifically that something is registered as IEnumerable<ValueType>, which affects all forms of registration.
anywho, you don't need to revert the change. i can exclude anything that implements IEnumerable<ValueType>. however, i'd also like to hear other opinions. thanks, bling On Thursday, July 12, 2012 1:16:28 AM UTC-4, Krzysztof Koźmic wrote: > > Well that's the thing. I'm not sure it's reasonable. If you want to > provide prices you'd expose that via a method, not on the type itself. > > And that's the reason for this change in the first place - value type or > collection of value type as a service is not a real service and it should > never have been supported. > > Since v3.1 is a minor update I guess I'm willing to revert that behavior > and keep it the old way in this case, while postponing the change to the > next major version. > > But in the long run, clearly you're registering a service that is not > meant to be a service, and is probably never used as such anyway. > > What do other folks think of that? > > @K > > > > bling wrote: > > > IMO, i think the whole point of having scanning is to avoid being > explicit. if i need to use WithService.Select, which is not much more > useful then registering everything explicitly, to get around the new > semantics of WithAllInterfaces, then its usefulness has decreased > substantially. > > aside, if a user wants to register IEnumerable<ValueType> into > Windsor, which worked before (and presumably every version prior to > 3.1), why was it changed to not support it? it's easy to come up with > a reasonable use case, like a service which provides real time stock > prices in the form of value types, exposed as IEnumerable<StockPrice>. > > thx, > bling > > On Wednesday, July 11, 2012 10:11:47 PM UTC-4, Krzysztof Koźmic wrote: > > I'm not sure I want to ignore anything. If a user wants to > register something they should either get it registered or should > be notified it's not supported. > > After giving it some more thoughts I'm thinking perhaps we should > leave the current behavior. If having IEnumerable<Something> is > not your intention be explicit about it and do not include it. > > The idea with "system interfaces" is more complicated than it > seems. In reality all Microsoft interfaces are in System.something > namespace so having a blanket arbitrary rule to filter them out > built into Windsor doesn't look like such a good idea after all. > > I think the solution I would advise and the one I'm leaning > towards most is to leave the behavior and API exactly as it is > now, and just recommend people to use WithiService.Select(be > specific here) instead. > > @K > > bling wrote: > > > > correction: "...since i would *not* expect that to throw..." > > On Wednesday, July 11, 2012 9:42:25 AM UTC-4, bling wrote: > > that would work. > > however, i'm more questioning in the intent of the scanning > registration API, since i would expect that to throw any kind of > exception. worst case should be that you don't have something > registered. if that can still be the case, then you can simply > ignore IEnumerable<ValueType> instead of throwing. > > if that won't fly, you could also do a > WithServiceAllInterfaces(bool excludeSystemInterfaces = true) > > thx! > > p.s. i've logged the bug at > http://issues.castleproject.org/issue/IOC-347 > <http://issues.castleproject.org/issue/IOC-347> > <http://issues.castleproject.org/issue/IOC-347 > <http://issues.castleproject.org/issue/IOC-347>>, although if you > add a new WithService* then it'd be more of a feature request. > > On Tuesday, July 10, 2012 6:09:48 PM UTC-4, bling 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/-/eTbUtzwyAZMJ > <https://groups.google.com/d/msg/castle-project-users/-/eTbUtzwyAZMJ>. > To post to this group, send email to > [email protected] > <mailto:[email protected]>. > To unsubscribe from this group, send email to > [email protected] > <mailto:castle-project-users%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en > <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/-/kJsk4S5RkAoJ. > 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/-/QKsGQAb3LhYJ. 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.
