Basicly I can register one service like this.
Container.Register(Component.For<IMyService>()
.AsWcfClient(new DefaultClientModel() {
Endpoint = WcfEndpoint
.BoundTo(new NetNamedPipeBinding())
.At("net.pipe://localhost/MyService") })
.LifeStyle.PerWebRequest);
But I could not figure out how to register all my services with similar configuration.
the thing I was hoping to run is this...
Container.Register(
AllTypes.FromAssemblyNamed("My.Server.MyContracts")
.Pick().If(x => x.Name.EndsWith("Service"))
.Configure(configurer => configurer.Named(configurer.Implementation.Name)
.AsWcfClient(new DefaultClientModel
{
Endpoint = WcfEndpoint.BoundTo(new NetNamedPipeBinding())
.At(string.Format("net.pipe://localhost/{0}", configurer.Named(configurer.Implementation.Name)).Substring(1))
}))
.LifestylePerWebRequest()
);
How can I register all services as wcf client?
Using Windsor 3.0, you just need to use Types instead of AllTypes so that it registers the service interface and generates a client side dynamic proxy for you like so:
Container
.Register(
Types
.FromAssemblyNamed("My.Server.MyContracts")
.Pick()
.If(x => x.Name.EndsWith("Service"))
.Configure(
configurer => configurer.Named(configurer.Implementation.Name)
.AsWcfClient(new DefaultClientModel
{
Endpoint = WcfEndpoint
.BoundTo(new NetNamedPipeBinding())
.At(string.Format(
"net.pipe://localhost/{0}",
configurer.Name.Substring(1)))
}))
.LifestylePerWebRequest());