Hi,

I've traditionally created wcf client proxies by using the ChannelFactory 
and doing something like this:

var factory = new ChannelFactory<IHelloService>(new NetTcpBinding());
try
{
    IHelloService channel = factory.CreateChannel(new 
EndpointAddress("net.tcp://localhost:9101/hello"));
    using (var clientChannel = channel as IClientChannel)
    {
        channel.SayHello("world");
        clientChannel.Close();
    }
}
finally
{
    factory.Close();
}


As you can see, I'm creating the channel factory, creating the channel, closing 
the channel, disposing the channel and finally closing the factory.  And all of 
this for each call.  It probably isn't the best way, but it works well enough.

Now, I've configured the client with the Windsor Wcf Facility like so:


var container = new WindsorContainer();
container.Kernel.AddFacility<WcfFacility>();
container.Register(Component.For<IHelloService>()
                       .AsWcfClient(new DefaultClientModel
                       {
                           Endpoint = WcfEndpoint.BoundTo(new NetTcpBinding())
                               .At("net.tcp://localhost:9101/hello")
                       }));


And I'm using the service like this:

var service = container.Resolve<IHelloService>();            
service.SayHello("world");


Right now, by default, the lifestyle of the IHelloService component should be 
Singleton unless AsWcfClient uses another lifestyle under the cover (I have not 
seen this in the source).

Should I be using a specific lifestyle?

Once I've resolved the service and I'm done using it, should do something 
particular with that (the) instance?

By the way, the client is used in a windows forms app.

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to