Tuesday, September 15, 2009

Get started with .NET RIA Services

This week I finally got the time to do a deep dive into the world of Silverlight and RIA Services. I’m impressed. This is a really great framework and really takes out some of the pains we had before on business application development. Most applications have a large portion of data-driven stuff in them and this framework reduces the code you need to put-up to run such features to almost nothing.

To get started download and install:

Visual Studio Tools for Silverlight 3

Expression Blend 3 (Not really required but very useful to design silverlight xaml controls.)

Silverlight 3 Toolkit

.NET Ria Services (Don’t forget to download the overview pdf because it contains documentation and hands-on labs.)

SQL Server 2008 Express Edition with Advanced Services

SQL Server 2008 Sample Databases (In this one I choose to install only the files and them run the scripts in management studio.)

The first project

Once everything is installed you can find the Silverlight Business Application template in the Silverlight area for new projects.

ria - create the project

This template will output two projects. One for the Silverlight client and one for the Web Application that contains the server side of the .NET Ria Services.

ria - project structureIf you go to the properties page of the silverlight client you will something called .NET RIA Services link. This setting is telling the extensions that RIA installed in visual studio to project code from the given Web Site into this project. But what does projecting mean?

ria - project linkIf you click on the option to see all files under the client project you will see a folder called Generated_Code. This will contain one file with a name similar to the web site that makes us think they are somehow related. And they are. Projecting means that parts of the code that we are writing at the server will get transformed into equivalent client side code. The word transform here is important because in some cases it is not a simple copy.

ria - exploring code projection 1 

In this article I am following most of the steps included in here.

More advanced stuff – Entity Framework and POCOs

The first thing to get is this sample. If you are already using visual studio 2010 there is a better approach because POCOs are already supported in a CTP here. What these downloads contains is the infrastruture to use simple C# objects as entities in Entity Framework.

 

Have Fun,

No comments: