(X) Hide this
    • Login
    • Join
      • Generate New Image
        By clicking 'Register' you accept the terms of use .

Creating applications with WCF RIA Service Part 1 - Introduction

(20 votes)
Martin Mihaylov
>
Martin Mihaylov
Joined Oct 29, 2007
Articles:   50
Comments:   70
More Articles
12 comments   /   posted on Mar 19, 2009
Categories:   Data Access , Line-of-Business
This article has been written for an older version of WCF RIA Services. To find out how to use the latest version of the WCF RIA Services read the dedicated article series and webinars by Brian Noyes.
WCF RIA Services Part 1: Getting Started | Watch the webinar recording

Several months ago the guys from Microsoft announced that they are developing a framework for developing Business applications under Silverlight with the codename Alexandria and now it's a reality! On the MIX'09 session a release of it under the name WCF RIA Services was announced.  The possibilities that the framework are really great and allow the Silverlight developers to easily develop business application in a much easier and faster way.

I am starting this series of articles in order to introduce the main features of the WCF RIA Services framework. The first articles are concerning more trivial things, but the deeper we go in the framework the more interesting it will get. In this article I'll make an overview of the main features of the framework and will describe a sample application that I will try to create with it.

Features

Those of you who have previously worked with ASP.NET will be positively surprised by the most of the features. A lot of goodies from the ASP.NET are now available under Silverlight, thanks to the new release of Silverlight 3 and the WCF RIA Services.

The Silverlight Application project

The first thing you should know about the WCF RIA Services is that they don't use a special project template, but use the default "Silverlight Application" one. Of course there are some modifications made to it, in order to work with the framework.

If you select the client Silverlight project and click on the "Show All Files" icon in the solution explorer, you will see a GeneratedCode folder. It is used by the server project to generate or copy parts of code on the client, that can later be used in the client application. There is no need to include this folder in the project, also do not add these files under source control, because they are dynamic and are generated on every build. In one of the next articles we'll see which code gets included on the client.

DomainService

If you take a quick look at the "New Item" templates in the Visual Studio you will notice a new one - the Domain Service Class. The class created inherits from the DomainService class and will be your main container for business logic while developing with the WCF RIA Service framework. It's one of the classes which content is generated on the client.

Shared files

The code files marked with "shared" in their name (MyClass.shared.cs) are directly copied in the GeneratedCode folder on the client. Be careful though, not everything that is available on the server is available on the client!

DomainDataSource

Do you remember the ObjectDataSource in ASP.NET? Now we have one in Silverlight too! The control is called DomainDataSource and can use a DomainService class in order to load and modify information. It also provides some cool features - you can load the information from the server in pieces. Read more about that in one of the next articles.

Sorting, filtering and paging

Actually the sorting and the filtering is functionality of the DataSource, but I think I can dedicate a separate article to them. When using sorting and/or filtering they are applied to the collection that the DataSource has loaded. The paging is part of Silverlight 3 and works with any control that has a collection of items for its source, so I think it do some nice work together with the DomainDataSource.

Authentication and Roles

The Authentication and Roles services from ASP.NET are now implemented by default in the Silverlight application, which means that they are ready to use and you don't have to create any service or add service references.

The Demo Application

To demonstrate all of the features of the WCF RIA Services and some of the new features of Silverlight 3, I've decided to recreate the ASP.NET Web Administration Tool. Of course it's much more simplified and allows some basic actions like displaying information, modifying it, adding new one to a DataBase. It has in itself all the stones needed to build a base for a business application and also explains the basics around the new framework.

Here is link to the demo and the source code to it. Note the it will be extended with every article of the series.

Conclusion

With the release of Silverlight 3 and the WCF RIA Services framework we are now able to create much more functional and interactive applications in less time. There were a lot of questions about Silverlight and Business applications in the past, now we have an answer from the Silverlight team .Probably it won't answer all the questions at once, but at this time it's great to know that the creating of Business applications under Silverlight is easier and faster!

 


Subscribe

Comments

  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Sanjay Singh on Mar 20, 2009 02:24
    Thanks Martin for the article. It will be a great start to work on SL3 building LOB apps.I have a question, when nagiating the records using the paging it is taking more time even though the page is already loaded. I went from page 1 to 2 and then when I click back it takes the same time. Any specific reason? Is it the default behavior?
  • Enrai

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Enrai on Mar 20, 2009 04:17
    Hi, Sanjay!

    Yes, there is a specific reason for this and is related to the DomainDataSource and the paging. The DomainDataSource controls has a LoadSize property, which determines the count of the items loaded. When not set and there is a DataPager control bound to the DomainDataSource, it loads a number of items equal to the page size.

    The next article of the series will be focused on the DomainDataSource and we'll take a much closer look at this feature of the control. :)
  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Sanjay Singh on Mar 20, 2009 09:30
    Thank you Martin for clarification.
  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Ben on Jul 22, 2009 21:32

    Thank you for the article! Silverlight and RIA Services are so exciting!!

    So far, the one thing I can't find any information about is CRUD to the server file system through RIA Services.

    I have a project from a client where the ability to administer a subfolder on the server-side is central (CRUD directories and files within a subfolder in the web app). I'd love to be able to do this project with SL3 and RIA services!

    Is this possible at this time? If so, is there any chance someone could share some working examples on how to do this with SL3 and RIA Services?

    Thank you so much for your time and sharing your knowledge :-)

     

     

  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Scott on Aug 15, 2009 07:25

    hi there,

    It seems that this article has not included the pre-requisites or requirements in order to run Silverlight 3 + RIA Services on a server. Therefore, I have a couple of things to add and the followings are stuffs that must be installed on the server:

    1. .NET3.5 Framework
    2. Full Trust mode must be enabled
    3. Install the Visual Web Developer 2008 tool
    4. Install the Visual Studio 2008 Service Pack 1
    5. Run the Silverlight 3 Toolkit
    6. Run the RIA Service Installation
    7. Silverlight can run on either IIS6 or IIS7

    I am currently hosting my Silverlight 3 (+ RIA Service) with ASPHostCentral (http://www.asphostcentral.com/) and so far, everything works smoothly. To be honest, there are so many exciting things about this latest Silverlight 3, with an exceptional extra feature of RIA Services. I am still exploring further features, which include Expression Blend and hopefully, I can see more interesting articles here :)

  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by puvvu on Sep 23, 2009 12:36
    orey puvva
  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Steve on Oct 27, 2009 15:37
    It would be great to see these articles updated for silverlight 3.
  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by dotnetster on Nov 16, 2009 12:07

    The demo didn't work for me:  The error I got was:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
    Timestamp: Mon, 16 Nov 2009 10:05:55 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

     

  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Bill on Nov 26, 2009 08:50
    Demo won't compile claims it needs system.web.silverlight which does not ship with 3.0.
  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by suleman on Dec 17, 2009 13:50

    Hi,
    the following code works fine and bind records with grid.

    EmployeeDomainContext employeeDomainContext = new EmployeeDomainContext();
    employeeDomainContext .Load<Employee>(employeeDomainContext .GetEmployeeQuery();
    dgrEmployee.ItemsSource = employeeDomainContext.Employees;

    But if I want to get records from employeeDomainContext.Employees then I am not be able to get these records, even it shows its count to 0.

    Can I get these records in a variable?

     Thanks and Best Regards,
    Hafiz Muhammad Suleman

  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Peter on Feb 12, 2010 20:12

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.4; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
    Timestamp: Fri, 12 Feb 2010 18:11:17 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

     

  • -_-

    RE: Creating applications with .NET RIA Service Part 1 - Introduction


    posted by Ryan on May 05, 2010 09:34

    I cant seems to open the demo for this tutorial, I get the following message.

    This application was created for an expired beta release of silverlight.

Add Comment

Login to comment:
  *      *       

From this series