Advertisement

.NET RIA Services Update with new Silverlight project template

We’ve update the .NET RIA Services build for May 2009.  The updated May preview can be downloaded here: .NET RIA Services May 2009.  You may have to uninstall your previous version before installing this one. 

What is .NET RIA Services?
Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.

This update incorporates a bunch of fixes that have been reported in the RIA Services forum.  This is a good place to report issues and communicate with the dev team.  Most fixes came from the forum.  In addition, DomainService base classes now infer some data access metadata based on the model (length, required for example).  There are a few other samples that were added to this as well to note:

Also upon installing you’ll see a new project type called the Business Application Template.  Right now it looks and feels exactly like the navigation template with the Silverlight tools, but has a few defaults added, namely authentication.  You’ll see in the ASP.NET project there with a Services folder and three new files: AuthenticationService, UserInformation, UserRegistrationService.  These are all services to expose authentication and membership integration.  Running the template by default will give you a new “login” link in the upper right and clicking on that implements a new ChildWindow for login:

Biz App Login Template

Notice the "Register now” link which then uses another ChildWindow control for registration:

Biz App Register Template

Registering a new user uses the UserRegistrationService to add a new user to the system.  If you look at the UserRegistrationService you’ll see that it uses the ASP.NET Membership APIs:

   1: namespace BusinessApplication2.Web
   2: {
   3:     [EnableClientAccess]
   4:     public class UserRegistrationService : DomainService
   5:     {
   6:         // NOTE: This is a sample code to get your application started. In the production code you would 
   7:         // want to provide a mitigation against a denial of service attack by providing CAPTCHA 
   8:         // control functionality or verifying user's email address.
   9:  
  10:         public void AddUser(UserInformation user)
  11:         {
  12:             MembershipCreateStatus createStatus;
  13:  
  14:             // NOTE: ASP.NET by default uses SQL Server Express to create the user database. 
  15:             // CreateUser will fail if you do not have SQL Server Express installed.
  16:  
  17:             Membership.CreateUser(user.UserName, user.Password, user.Email, user.Question, user.Answer, true, null, out createStatus);
  18:             if (createStatus != MembershipCreateStatus.Success)
  19:             {
  20:                 throw new DomainServiceException(ErrorCodeToString(createStatus));
  21:             }
  22:         }
  23:         
  24:         // other methods exist here
  25:         // ...
  26:     }
  27: }

Because the membership APIs are provider-based, you can leverage whatever you want for your membership model and still use those APIs.  The example uses the default mechanism in ASP.NET.

Download the updated RIA Services bits today and take a look at the new template for integrating with the various ASP.NET providers.  Thanks for the continued feedback and keep it coming!


This work is licensed under a Creative Commons Attribution By license.

  1. 5/19/2009 10:49 AM | # re: .NET RIA Services Update with new Silverlight project template
    Is it possible to write an article showing how to use membership APIs for this template?
    Basically adding the missing pieces to make it work.
    Thanks so much.
    Rachida
  2. 5/19/2009 11:26 AM | # re: .NET RIA Services Update with new Silverlight project template
    Hi tim.

    .NET RIA Service is my favorite feature in Silverlight news. This month i write a article for .NET Magazine ( A braziliam magazine ) about .NET RIA Service. Is very simple to development using that and incredibly easy. This new template is great to understand how the .NET RIA Service use the ASP.NET authentication services. Very very good. With the last new features, the Silverlight platform increase the productivity, learn curve, and UX capabilities whit the SketchFlow.
  3. Gravatar
    5/20/2009 1:48 PM | # re: .NET RIA Services Update with new Silverlight project template
    Hi Tim,
    Does this work with VS2010? when I tried to install it said required components are missing
  4. 5/20/2009 2:14 PM | # re: .NET RIA Services Update with new Silverlight project template
    No, RIA services bits will likely not work with VS2010 at this point...couldn't get things in time for Beta 1
  5. 5/28/2009 2:45 PM | # re: .NET RIA Services Update with new Silverlight project template
    Will there be any "Training-Video" like your Video for the great Navigation-Framework or OOB for the .NET RIA Services?
  6. 5/28/2009 3:44 PM | # re: .NET RIA Services Update with new Silverlight project template
    Alexander -- we will for the SL3 release, yes.
  7. 5/29/2009 12:23 AM | # re: .NET RIA Services Update with new Silverlight project template
    Great Thanks ;D
  8. 11/3/2009 3:37 PM | # re: .NET RIA Services Update with new Silverlight project template
    Hi,
    I tried using the Silverlight business application template in VS 2008 to create RIA a webservice.
    I did see the generated code in the web application project where I need to use this RIA service, but I don't see the call back method in the DomainContext class. Hence I have to call my method sync way. I have used the right attributes in my DomainService class.

    Can you please let me know if I'm missing anything.

    Thanks
    Veena

 
Please add 8 and 4 and type the answer here:
First time here? You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting! (hide this)