terça-feira, 28 de julho de 2015

WCF ClientBase and Command Dispatcher

What is WCF?

Windows Communication Foundation (WCF) is a unified, simplified and optimized evolution of a number of communication technologies into a single model. Most of the WCF functionalities are included in a single assembly called System.ServiceModel.dll in the System.ServiceModel namespace.


To run WCF service on the client side you have some options:

Option 1: Generate Adding Proxy Service Reference


Problem for enterprise application:

- Updates on service
- Changes in the service configuration


Option 2: Generate Proxy by implementing ClientBase<T> class


It is a good option, but in a great architecture generation can become unproductive and without much need.

Option 3: Generate Dynamic Command Dispatcher

Let's encode!!








Method overloading sending client credencial...



Method overloading sending custom header...



Async method run...



Usage!!



...With this implementation the service call is dynamic and independent enabling updates on unchanged in customer service.

Thanks, Happy coding :)

Nenhum comentário:

Postar um comentário