With some knowledge of asynchronous programming and callbacks, you can use Silverlight to develop applications that are bound to data retrieved from different services -- services that can scale over time. One service in particular, WCF RIA services can come in handy while developing data-driven applications in Silverlight.
This article offers an introduction to WCF and WCF RIA services, discussing the features and benefits of both.
What Is WCF?
The Windows Communication Foundation (WCF) is a Microsoft programming framework that enables developers to implement service-oriented applications. WCF supports messaging and can be used to design and implement platform-independent, scalable services. Microsoft created WCF to unify a number of enterprise technologies under one model.
The WCF transport channels support two modes for transferring data:
- Buffered -- the complete data is held in the memory buffer until the transfer is complete
- Streamed -- the message body is exposed as a stream and data is read in one chunk at a time
Note that WCF was introduced as part of .NET Framework 3.0. WCF 4, the version referred to in this article, was released some time ago. At the time of its release, it introduced quite a few enhancements and new features. Some of the major enhancements included support for REST-based services and the introduction of WCF RIA Services.
What Are WCF RIA Services?
When you build applications that are data centric, the data can come from disparate systems. In order to get this data, you need to have the business logic and the server objects reside on the client side. This becomes very cumbersome, taking up a lot of memory on the client side. This is where WCF RIA Services comes in. WCF RIA Services was introduced in .NET Framework 4 and Silverlight 4 to allow developers to build applications without the need for service plumbing to push or pull data from the client side.
WCF RIA Services can be used to simplify n-tier applications such as Silverlight applications. You can use WCF RIA Services to make the application logic residing on the server available to the client without the need to duplicate the application logic on the client side. Also, as your business rules or application logic on the server side is updated, the client is automatically updated with the latest middle-tier logic once the application is compiled. Note that WCF RIA Services are built on top of WCF Services.
"To create the best user experience, you want your RIA Services client to be aware of the application logic that resides on the server, but you do not want to develop and maintain the application logic on both the presentation tier and the middle tier. RIA Services solves this problem by providing framework components, tools, and services that make the application logic on the server available to the RIA Services client without requiring you to manually duplicate that programming logic."
The WCF RIA Services Wrap-up
Here are the basic offerings of WCF RIA Services, which differ from WCF's:
- In WCF RIA Services, the client-side objects are created using reflection at the time of compilation based on the server-side objects instead of service contracts exposed on the server side. This provides a rich object model as the business rules and other objects are made available on the client side.
- The RIA services provide support for serializing LINQ queries much like ADO.NET data services.
In essence, this implies that you can create your LINQ query on the client side and execute it on the server side, as the LINQ queries can be serialized.
WCF provides you a programming model and a framework that has support for interoperable, reliable, secure communication. In essence, it provides a framework for designing and developing a service-oriented messaging system that is reliable and transacted. This article discussed the basics of WCF and WCF RIA Services.