Silverlight 5 WCF RIA Services: Part 1


In this article we are going to explore the WCF Ria Services with Silverlight 5. Lets start with the basics for the first timers .

Create a new SL project as shown below :

SltWCF1.gif

Note the DLLs that are added when you enable WCF RIA Service support .

SltWCF2.gif


In the web project Add New Item . Add a Data Model as shown below :

SltWCF3.gif

SltWCF4.gif

SltWCF5.gif

SltWCF6.gif

SltWCF7.gif

Then Build the Solution . It is necessary you give it a build otherwise when we create a Domain Service , the Data Model would not be recognised by the Domain Service .

Creating a Domain Service :

In the Web project , add a Domain Service .

SltWCF8.gif

Add new Domain Service class Dialog appears .

SltWCF9.gif

Select the Article Entity .

SltWCF9.5.gif

A couple of classes are generated as shown below :

SltWCF11.gif

Give it a Build again .

Go to the Data Menu and click Show Data Sources .

SltWCF12.gif


Data Sources Panel should now show the DataDomainContext . Under that Article .

SltWCF13.gif


Select the Article and a drop down appears . say Customize as shown below :

SltWCF14.gif


Go ahead and attach the DataGrid Control to the Data Source . You could select themes as well.

SltWCF15.gif

Notice the change in the icon .

SltWCF16.gif


Now go to the Design Screen . Simply drag and drop the entity into the MainPage layout area . A datagrid should be added automatically now .

Make sure AutoGenerateColumns="True" .

SltWCF17.gif

Build and Run it.

SltWCF18.gif


In the next post we will check out some advanced concepts in WCF Ria Services . Till then Happy Coding .


Similar Articles