Silverlight and .NET RIA Services - Step by Step - 1

by rahul 9/18/2010 4:31:25 PM

If you are still thinking, WHY learn .NET RIA Services, read this

In the following series of posts, I will try explain how to work with .NET RIA Services using Silverlight 4 and Visual Studio 2010. Proceed with binary setup from here if you don't have it installed already. You also need to setup Chinook Database if you want to follow along.

Setting up Chinook Database…

    Download the database from http://chinookdatabase.codeplex.com/
    Chinook Schema is http://chinookdatabase.codeplex.com/wikipage?title=Chinook_Schema&referringTitle=Home
    Double click on [Download Path]\ChinookDatabase1.1\Scripts\SqlServer\CreateDB.bat [By default it installs under local machine\SQL Express. If you have any other database server, modify the batch file and proceed accordingly]
    If everything goes well, you should have your database setup

<snippet from http://chinookdatabase.codeplex.com>

image

Database Schema

The Chinook database schema represents a digital media store, including tables for artists, albums, media tracks, invoices and customers. You can see the Chinook database schema here.

Why the name Chinook?

The name of this sample database was based on the Northwind database. Chinooks are winds in the interior West of North America, where the Canadian Prairies and Great Plains meet various mountain ranges. Chinooks are most prevalent over southern Alberta in Canada. Chinook is a good name choice for a database that intents to be an alternative to Northwind.

</snippet>

    Start Visual Studio 2010. Select File -> New Project
    Ensure that .NET Framework 4 is selected
    From the Installed Templates section, select Silverlight -> Silverlight Business Application
    Name it ChinookSample. Click Ok to create the project and necessary associations.
    Open Server Explorer (CTRL + ALT + S) or View -> Server Explorer
    Click Connect to Database and connect to Chinook database
    Inside the ChinookSample.Web project, Add new Item… choose the following and select Add

SNAGHTML6c275f

    Choose the following and click Next

SNAGHTML6d6bbf

    Choose the Chinook data connection and click Next…

SNAGHTML736a58

    Ensure that Tables is selected. Click Finish.

SNAGHTML77d682

    The data model will be ready by now. Rearrange the tables to suit yourself…

image

    Compile the Solution once and switch to Solution Explorer.
    Right click on Services and select Add new Item

image

    Select Domain Service class… and name it dsAlbumAndArtist. Click Add.

SNAGHTML93aaa3

    Ensure that the following are checked…

SNAGHTML97d0e8

    Let's try to understand what all has happened in the background before you proceed further…

image

 

image

    Recompile the Solution.
    You will find in the Solution, you will get a folder called Generated_Code which is a projection of the Domain Service in the Silverlight Client Application that we created on the Server side.

image

    As you can see, Visual Studio 2010 has already done the plumbing behind the scenes.
    In the next post, we will take it a few steps further.

Stay tuned… Wave
Rahul

 


Quote of the day:
There is always some madness in love. But there is also always some reason in madness. - Friedrich Nietzsche


blog comments powered by Disqus

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  June 2013  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

All Items
Sign in

Visit Microsoft's Site

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2013, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0