Silverlight Application With RIA Service

Microsoft simplifies the integration of n-tier application development in Rich Internet Application by introducing WCF RIA Services. WCF RIA (also called Domain services) is traditional n-tires application pattern, used with RIA such as Silverlight and it can be used as middle tier.

To know more about WCF RIA Service please refer to the following link.

Steps for creating such an application are below.

  1. Create New Silverlight Application

    New project >> Select Silverlight Application.

  2. Check "Enable WCF RIA Services" check box

  3. Create Entity Data model.



  4. Select tables, views and stored procedure from given list to add it to the entity data model.

  5. Create Domain Service.

    Before adding a new domain service, compile the web project.


  6. Map or enable entity(s) with domain service. In the Entities list you get all tables (also called entities) available in the entity model.


  7. Now build both projects; Silverlight as well as web. After compiling you will have automatically generated code in the Silverlight project which is responsible for communication between Silverlight and the Domain service.


  8. The Domain service has many built-in methods for selecting, inserting, updating and deleting the entity(s). You may also add new methods as per your requirement.

In the attached Silverlight project we a create a custom method to get the customer from its id.

CustomerMaster GetCustomerFromId(int customerId)
    return this.ObjectContext.CustomerMasters.Where(d => d.CustomerId == customerId).FirstOrDefault();

After completion of the web project, you may access this method in Silverlight project.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now