SIGN UP MEMBER LOGIN:    
ARTICLE

Silverlight Application With RIA Service

Posted by Jignesh Trivedi Articles | Silverlight with C# January 06, 2012
This article describes, how to develop a Silverlight application with a domain service using Entity Framework 4.0.
Reader Level:

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.

http://msdn.microsoft.com/en-us/library/ee707344%28v=vs.91%29.aspx

Steps for creating such an application are below.

  1. Create New Silverlight Application

    New project >> Select Silverlight Application.

    1.png
     
  2. Check "Enable WCF RIA Services" check box

    2.png
     
  3. Create Entity Data model.

    3.png

    4.png

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

    6.png
     
  5. Create Domain Service.

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

    7.png

  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.

      
    8.png

  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.

    9.png


  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.

public
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.

Login to add your contents and source code to this article
share this article :
post comment
 

Very useful articles

Posted by Sonakshi Singh Feb 06, 2012

Thanks to all reviewers.

Posted by Jignesh Trivedi Jan 08, 2012

Thanks

Posted by Jignesh Trivedi Jan 08, 2012

Thanks

Posted by Arjun Panwar Jan 07, 2012

it's really helpful and useful

Posted by Manish Singh Jan 07, 2012
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Gauge for SharePoint
Become a Sponsor