Thanks a lot!
Unless I'm doing it wrong, it still seems like a lot of code though, when
used with generic interfaces:
container.Register(Classes.FromThisAssembly().BasedOn(typeof
(CommandExecutor<>))
.ConfigureIf(registration =>
registration.Implementation.GetInterfaces().Any(x => x.IsGenericType &&
x.GetGenericTypeDefinition() == typeof (IHandleMessages<>)),
registration =>
{
var genericArgument =
registration.Implementation.GetInterfaces()
.First(y =>
y.GetGenericTypeDefinition() == typeof (IHandleMessages<>))
.GetGenericArguments()[0];
registration.Forward(typeof
(IHandleMessages<>).MakeGenericType(genericArgument));
})
.WithService.Base().LifestyleTransient(),
Classes.FromThisAssembly().BasedOn(typeof
(IHandleMessages<>)).WithService.Base().LifestyleTransient());
Would it be meaningful to support multiple BasedOn or'ed together? Would
you accept a patch?
//Asger
On Friday, 31 August 2012 23:17:56 UTC+2, Krzysztof Koźmic wrote:
>
> you can do it by saying (pseudo-syntax)
>
> Register.BasedOn<A>.ConfigureIf<B>(Forward<B>)
> Register.BasedOn<B>
>
> --
> Krzysztof Kozmic
>
> On Saturday, 1 September 2012 at 12:04 AM, Asger Hallas wrote:
>
> Hi
>
> I guess this is actually a feature request - or maybe I just don't get how
> to do it right.
>
> I wonder if it would be possible to:
> Register all types based on one generic interfaces and then all types
> based on another generic interface - and have windsor register both generic
> interfaces as services for the types that implements both?
>
> Thus having Windsor aggregate services for the component if the same type
> is registered with several services?
>
> I originally posted a stackoverflow question about my actual problem here:
> http://stackoverflow.com/questions/12111502/registering-the-same-classes-with-two-services-in-two-steps-in-castle-windso
>
> But I have not had so much luck with it :)
>
> Can you tell me, if I need to do it otherwise - and if the feature of
> unioning services from multiple registrations of the same type actually
> could make sense?
>
> Cheers,
> Asger
>
> --
> 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/-/6xZdNN8hHycJ.
> To post to this group, send email to
> [email protected]<javascript:>
> .
> To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> 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/-/ST6IpbnjeDcJ.
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.