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>
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.
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
Choose the following and click Next
Choose the Chinook data connection and click Next…
Ensure that Tables is selected. Click Finish.
The data model will be ready by now. Rearrange the tables to suit yourself…
Compile the Solution once and switch to Solution Explorer.
Right click on Services and select Add new Item…
Select Domain Service class… and name it dsAlbumAndArtist. Click Add.
Ensure that the following are checked…
Let's try to understand what all has happened in the background before you proceed further…
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.
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.
Quote of the day:
There is always some madness in love. But there is also always some reason in madness. - Friedrich Nietzsche