Working with WCF RIA Services

This article discusses WCF, WCF RIA Services and their features and benefits. It also discusses why WCF RIA Services are useful and where they come in handy while developing data driven applications in Silverlight. Silverlight is a great tool that you can use to work with data retrieved from different services. With some knowledge of asynchronous programming and callbacks, you can use Silverlight to develop applications that are bound to data retrieved from different services that can scale over time. The article focuses on how Silverlight and WCF RIA Services can be used in conjunction with Silverlight to access the server objects easily using reflection.

What is Windows Communication Foundation?

Windows Communication Foundation (better known as WCF) is a framework from Microsoft that you can make use of to implement service-oriented applications. It is service-oriented, supports messaging and offers a reliable, transacted service oriented framework. It is a platform that can be used to design and implement platform independent, scalable services. It is a framework from Microsoft that provides a platform for unification of a number of enterprise technologies under one roof. MSDN states, "Windows Communication Foundation (WCF) is Microsoft's unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments."

The WCF transport channels support two modes for transferring data. These are:

  • Buffered - in this mode, the complete data is held in the memory buffer until the transfer is complete
  • Streamed - in this mode, the message body is exposed as a stream and data is read in one chunk at a time

Windows Communication Foundation Version 4 was released some time ago by Microsoft. Note that WCF was introduced as part of .NET Framework 3.0. There have been quite a few enhancements and new features introduced in WCF 4.0. Some of the major enhancements in WCF include support for REST based Services and the introduction of WCF RIA Services.

What are WCF RIA Services?

When you need to build applications that are data centric, the data can come from disparate systems. In order to get this data you would need to have the business logic and the server objects reside at the client side. This becomes very cumbersome and takes up a lot of memory at the client side. This is exactly where WCF RIA Services fit in. WCF RIA Services has been introduced in .NET Framework 4 and Silverlight 4 to build applications without the need of service plumbing to push or pull data from the client side.

WCF RIA Services can be used to simplify the n-tier applications such as Silverlight applications. WCF RIA Services can be used to avoid duplicating the application logic both on the server and the client side. You can use WCF RIA Services to makes the application logic residing on the server available to the client without the need of duplicating the application logic on the client side. Also, when your business rules or application logic on the server side are updated, the client automatically updates with the latest middle tier logic once the application is compiled. Note that WCF RIA Services are built on top of WCF Services.

Difference between WCF and WCF RIA Services

This section discusses the basic differences between WCF and WCF RIA Services.

1. 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 at the server side. This provides a rich object model as the business rules and other objects are made available at the client side. In essence, this implies that you can create your LINQ query at the client side and execute it at the server side as the LINQ queries can be serialized.

2. The RIA services provide support for serializing LINQ queries much like ADO.NET data services.

Summary

The MSDN states: "WCF RIA Services simplifies the development of n-tier solutions for Rich Internet Applications (RIA), such as Silverlight applications. A common problem when developing an n-tier RIA solution is coordinating application logic between the middle tier and the presentation tier. 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. You can create a RIA Services client that is aware of business rules and know that the client is automatically updated with the latest middle tier logic every time that the solution is re-compiled." 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, transacted. This article discussed the basics of WCF and WCF RIA Services and how the later can be implemented in applications. In a future article in this series of articles on WCF RIA Services, I will illustrate how to get started with WCF RIA Services. Happy reading!

References

WCF RIA Services

WCF RIA Services e-Book Author: Brian Noyes

A Developer's Introduction to Windows Communication Foundation 4

WCF TCP-based File Server



About the Author

Joydip Kanjilal

Microsoft Most Valuable Professional, Author and Speaker. Featured in "MSDN Featured Developer of the Fortnight (India)" a number of times. Winner of Community Credit Awards at www.community-credit.com several times. Authored numerous books and articles in Microsoft .NET and its related technologies. Authored the following books:-- ASP.NET 4.0 Programming (Mc-Graw Hill Publishing) Entity Framework Tutorial (Packt Publishing) Pro Sync Framework (APRESS) Sams Teach Yourself ASP.NET Ajax in 24 Hours (Sams Publishing) ASP.NET Data Presentation Controls Essentials (Packt Publishing)

Related Articles

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Hybrid cloud platforms need to think in terms of sweet spots when it comes to application platform interface (API) integration. Cloud Velocity has taken a unique approach to tight integration with the API sweet spot; enough to support the agility of physical and virtual apps, including multi-tier environments and databases, while reducing capital and operating costs. Read this case study to learn how a global-level Fortune 1000 company was able to deploy an entire 6+ TB Oracle eCommerce stack in Amazon Web …

  • Live Event Date: August 14, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Data protection has long been considered "overhead" by many organizations in the past, many chalking it up to an insurance policy or an extended warranty you may never use. The realities of today makes data protection a must-have, as we live in a data-driven society -- the digital assets we create, share, and collaborate with others on must be managed and protected for many purposes. Check out this upcoming eSeminar and join Seagate Cloud …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds