Skip Navigation LinksHome / Articles / View Article

Creating applications with .NET RIA Service Part 2 - Creating the project

+ Add to SilverlightShow Favorites
3 comments   /   posted by Martin Mihaylov on Mar 19, 2009
(3 votes)
Categories: Demos , Learn , Tutorials , QuickStarts

Introduction

With the help of the .NET RIA Services framework we are now capable of creating business applications in Silverlight easy and fast. But before starting we should download and install the latest versions of Silverlight 3 and .NET RIA Services. In this article you'll find the needed links and a brief walkthrough of creating the project for our first Silverlight application using the .NET RIA Services Framework, as well as some highlights and explanations about the created project.

Here is a link to the live demo at this stage and the source code. Note that they will be updated with each article! ;)

Here is a link to the first part of the series:

Creating applications with .NET RIA Service  Part 1 - Introduction

.NET RIA Services and Silverlight 3

Before beginning to code your first application, you have to download and install the Silverlight 3 Tools for Visual Studio, which contain the tools, the runtime and the SDK. After that do the same with the .NET RIA Services.

According to the information provided by Brad Adams in one of the Channle9 clips, Silverlight 3 and the .NET RIA Services work on the Express version of Visual Studio too.

Creating the project

In Visual Studio select File->New Project and a prompt will appear where you'd be able to choose your template. In the Silverlight section you can see three templates: Silverlight Application, Silverlight Navigation Application (the Navigation is one of the new features of Silverlight 3, you can read more about it here) and Silverlight Class Library. Choose Silverlight Application, enter the name of your project and click "OK".

On the next window check both the "Host the Silverlight application in a new Web site" and the "Link to ASP.NET server project".

Click "OK" and that's it!

Highlights

As you can see there are no changes in creating a new Silverlight Application project, but changes to the project itself have been made in order to work with the .NET RIA Services framework.

First take a look at the references - the references that you'll use while creating your application are automatically added both on the client and on the server. The reference to the .NET RIA Services is System.Web.Ria, which has a client and server version. Another reference that is related to the framework is the System.Web.DomainServices, which, as the name hints, allows us to work with the DomainService class.

The other interesting thing is that the client and the server projects are connected to one another (remember the "Link to ASP.NET server project" checkbox?). In this way you can share code between the server and the client, so you don't have to write business logic both on the server and on the client. You write it only once and the code on the server gets generated on the client too (of course not every piece of code, this applies to some of the classes and files and will be discussed in the next articles). That is one of the most powerful features of the framework.

Now select your Silverlight project and click on "Show All Files" icon. You will see a folder named GeneratedCode. In this folder will be placed the code, generated from the server project on every build (first the server project will be build and then the client). You should not include this folder to your project or add it to source control.

Conclusion

Now we are ready to begin to develop our application! In the next articles I'll show how to create the business logic, load and modify data form a DB and some more.

Share


Comments

Comments RSS RSS
  • RE: Creating applications with .NET RIA Service Part 2 - Creating the project  

    posted by Scott on Aug 15, 2009 07:19
    Fantastic, this article is concise and truly helpful. Two thumbs up!!
  • RE: Creating applications with .NET RIA Service Part 2 - Creating the project  

    posted by Yogesh Tyagi on Feb 16, 2010 19:27

    Hi Nikhil,

    I am trying to see the live demo but it is giving me the following error -

    -----------------------------------------------------------------------------------------------------------------------------

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET CLR 3.5.30729; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
    Timestamp: Tue, 16 Feb 2010 17:22:37 UTC

    Message: Sys.InvalidOperationException: InitializeError error #2106 in control 'Xaml1': Failed to load the application. It was built with an obsolete version of Silverlight
    Line: 453
    Char: 17
    Code: 0
    URI: http://www.silverlightshow.net/showcase/WebAdministrationTool/ScriptResource.axd?d=2Pm4pLz4EAvMA7vnIxpzyegfFzvu5_74ExBIC96T8ZRcoBd2jqrHz272wGnHmbrLluXjnbUaXrdlKuJ8zMKCCg2&t=ffffffff9df4fb07

     -------------------------------------------------------------------------------------------------------------------------

    it says that the demo is created using an old verison of silverlight which is obsolete now, does it means silverlight do not support backward compatibility and with every new version of silverlight developers have to update there applications which are developed in old version??

  • RE: Creating applications with .NET RIA Service Part 2 - Creating the project  

    posted by raj on May 05, 2010 07:47
    where is the source code, And just wanted to know that how to create Silverlight Application....Web Apllication project in RIA services

Add Comment

 
 

   
  
  
   
Please add 5 and 7 and type the answer here:

Join the free SilverlightShow webcast 'Running Silverlight Outside the Browser and with Elevated Trust'. Sept 7th, 8 am - 9 am PDT.
In this live session Chris Anderson will cover configuring and debugging OOB mode, toast notifications, elevated trust, direct file access and much more.
Learn more | Register | See more webinars (hide this)