ServicesResourcesConferencesOur TeamWeblogsAboutContact
   

Subscriptions

Post Categories

Affiliations

Archives

Smells like a domain-specific language for using WCF

No, not these kinds of domain-specific languages (DSL)...
I must admit, the following code has a not too small degree of sexiness. The DSL-iness is not just for WCF but for a number of mainly dependency-injection-related scenarios, but obviously I tend to care more about WCF :)

Service side:

var windsorContainer = new WindsorContainer()
  .AddFacility<WcfFacility>()
  .Register(
    Component.For<LoggingInterceptor>(),
    Component.For<IMyContract>().ImplementedBy<MyService>()
      .ActAs(new DefaultServiceModel().AddEndpoints(
        WcfEndpoint
          .BoundTo(new NetTcpBinding())
          .At("net.tcp://localhost/MyService/internal")
          )
      )
  );


Consumer side:

var windsorContainer = new WindsorContainer()
  .AddFacility<WcfFacility>()
  .Register(WcfClient.ForChannels(
    new DefaultClientModel()
    {
      Endpoint = WcfEndpoint.ForContract<IMyContract>()
        .BoundTo(new NetTcpBinding())
        .At("net.tcp://localhost/MyService/internal")
    })
   )
  );

                    
I am currently investigating a bit into Windsor Castle and its WCF facility. What I see until now I like, but I am just at the beginning.
There is a lot more in Windsor's WCF support which is worth digging into - all in all these features are aimed to make using WCF a bit more natural and a  bit more straight-forward.

Some feature points from the latest release:

*Client Side:
  • Automatic generation of WCF client channels when a component has been configured for WCF Client capabilities.
  • Any Endpoint or Operation behaviors registered in the kernel will be attached to the channels.
  • Automatic cleanup of channel proxy when component is released (channel.Close() vs channel.Abort), i.e. no need to cast proxy to IChannel and call Dispose.
  • Automatic detection of unhanded channel faults and re-acquisition of new channel proxy. You can continue to use client proxy even after an exception occurs (by default WCF makes all faulted channels unavailable).
  • Ability to use the client channel configuration from app.config/web.config      
  • Custom registration provider to simplify batch registration of channels
  • Client extensibility interface IClientChannelBuilder. Supports plugging in other ways to create channels (e.g. REST-ful services)
 
*Service Side:
  • Automatic management of ServiceHost when a component is configured for WCF Service capabilities.
  • Any Service, Endpoint or Operation behaviors registered in the kernel will be attached to the channels.
  • Ability to use the service channel configuration from app.config/web.config
  • Service extensibility interface IServiceHostBuilder. Support for plugging in other ways to create ServiceHosts.
 More to investigate...


posted on Monday, May 19, 2008 11:10 AM

# Link Listing - May 19, 2008 @ Tuesday, May 20, 2008 8:45 AM

ASP.NET Integrated social networking in ASP.NET [Via: 100muses ] Sharepoint When to dispose of objects...
Christopher Steen


Powered by Community Server, by Telligent Systems