Also remember that if you want to avoid casting you may specify the name of the method as string.

Always a trade off

On 04/02/2011 11:54 AM, Adam Langley wrote:
Hey Krzysztof,

Thanks - I thought that might be the case, the nature of fluent and heavily 
nested generics...
But thought I would ask!

Adam Langley

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Krzysztof Kozmic
Sent: Friday, 4 February 2011 2:24 p.m.
To: [email protected]
Subject: Re: query about StartableFacility extension methods

it could be, but I'm not sure that would be possible without heavily
rebuilding the entire fluent API.

On 04/02/2011 11:22 AM, Adam Langley wrote:
Hi Team,

I have been using the StartableFacility during the registration of my service.
My service is publicly registered as an interface, but the 'start' method 
belongs to the concrete type.

When I register like this:

container.Register(
                  
Component.For<IQueryRemoteHandler>().ImplementedBy<ServerQueryRemotingHandler>()
                  .StartUsingMethod(server =>   (server as 
ServerQueryRemotingHandler).Start)
                  );

You see I have to cast my service before I can get to the 'start' method

This suggestion is really just about usability: Shouldn't the generic type 
argument for the 'StartUsingMethod' be the 'ImplementedBy' type, not the 'For' 
type?
The container knows the concrete type, so it should be able to pass that to the 
StartUsingMethod... not the interface

What do you think?

Adam Langley
Senior Developer

+64 9 486 9010
+64 21 884400
[email protected]
www.winscribe.com



   Please consider the environment before printing this email!


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

Reply via email to