Calling a WCF service from Silverlight using ChannelFactory

A lot of Silverlight applications using services are typically developed using the Add Service Reference dialog box to add service references that generate the client-side proxy classes. However, this isn't sufficient or advisable for some applications or pieces of code. You might want to call variable endpoints or you might be developing a library or a framework in which you wouldn't want to have service references for pluggability or for extension purposes (for example: through a provider pattern).

This is where a ChannelFactory comes in handy. Through a ChannelFactory, you can combine a binding and an address from code with a contract to open a channel to a service endpoint that implements ...

Get Silverlight 4 Data and Services Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.