📒
OpenRiaServices
  • Start
  • Prerequisites for Open Ria Services
    • Walkthrough: Installing and Configuring SQL Server 2008 R2 Express with Advanced Services
    • Walkthrough: Installing the AdventureWorks OLTP and LT sample databases
  • Creating Open Ria Services Solutions
    • Walkthrough: Taking a Tour of Open Ria Services
    • Walkthrough: Creating a Open Ria Services Solution
    • Walkthrough: Creating a Open Ria Service with the Code First Approach
    • Walkthrough: Using the Silverlight Business Application Template
    • Walkthrough: Creating a Open Ria Services Class Library
    • Walkthrough: Localizing a Business Application
    • How to: Create a Domain Service that uses POCO-defined Entities
    • How to: Add or Remove a Open Ria Services Link
    • Using the Domain Service Wizard
  • Building Secure Applications with Open Ria Services
  • Deploying and Localizing a Open Ria Services Solutions
    • Troubleshooting the Deployment of a Open Ria Services Solution
    • Troubleshooting the Deployment of a Open Ria Services Solution
    • Walkthrough: Localizing a Business Application
  • Middle Tier
    • Domain Services
      • Walkthrough: Adding Query Methods
      • How to: Add Business Logic to the Domain Service
      • How to: Create a Domain Service that uses POCO-defined Entities
      • How to: Use HTTPS with a Domain Service
    • Data
      • Compositional Hierarchies
      • Presentation Models
      • Inheritance in Data Models
      • Complex Types
      • Shared Entities
      • Walkthrough: Sharing Entities between Multiple Domain Services
      • How to: Add Metadata Classes
      • How to: Validate Data
      • Managing Data Concurrency
    • Shared Code
      • How to: Share Code through Source Files
      • Walkthrough: Creating a Open Ria Services Class Library
  • Silverlight Clients
    • Client Code Generation
    • DomainContext and Operations
    • DomainDataSource
    • Error Handling on the Client
    • Customizing Generated Code
      • How to: Add Computed Properties on the Client
  • Accessing non-Silverlight Clients
    • ASP.NET Clients
    • Walkthrough: Using the Domain Service in ASP.NET Applications
  • Authentication, Roles, and Profiles
    • How to: Enable Authentication in Open Ria Services
    • How to: Enable Roles in Open Ria Services
    • How to: Enable Profiles in Open Ria Services
    • How to: Create a Custom Authorization Attribute
    • Walkthrough: Using Authentication Service with Silverlight Business Application
    • Walkthrough: Using Authentication Service with Silverlight Navigation Application
  • End-to-EndScenarios
    • Walkthrough: Retrieving and Displaying Data From a Domain Service
    • Walkthrough: Editing Data From a Domain Service
    • Walkthrough: Displaying Data in a Silverlight Business Application
    • Walkthrough: Displaying Related Data in a Silverlight Business Application
Powered by GitBook
On this page
  • Prerequisites
  • To create a solution
  • To use Windows Authentication
  • See Also

Was this helpful?

  1. Creating Open Ria Services Solutions

Walkthrough: Using the Silverlight Business Application Template

PreviousWalkthrough: Creating a Open Ria Service with the Code First ApproachNextWalkthrough: Creating a Open Ria Services Class Library

Last updated 4 years ago

Was this helpful?

[ This document was written for WCF Services Version 1 Service Pack 2 and might not be up to date Please see or for a list of changes since WCF RIA Services ]

In this walkthrough, you will learn how to create a Open Ria Services solution by using the Silverlight Business Application template. This walkthrough shows how to create the application and how to use several of the features that are made available by the template with very little additional work. It also shows how to switch from the default authentication mode of Forms Authentication to Windows Authentication.

The Silverlight Business Application template creates a project that automatically includes many features that you typically want in a business application, such as controls to log in users and to register new users. The project created by the template is also set up to use Silverlight navigation, which means you can easily add new Silverlight pages for additional functionality.

By default, the Silverlight Business Application template enables authentication, roles, and profiles. The default authentication mode used by the template is Forms Authentication, but you can change the authentication mode to Windows Authentication by simply changing two configuration values. The procedure for making this change is provided here.

For more information about how to use the services for authentication, roles, and profiles supported in a Open Ria Services application, see the topics in the section.

Prerequisites

This and the other walkthroughs presented in the Open Ria Services documentation require several prerequisite programs, such as Visual Studio and the Silverlight Developer Runtime and SDK, be installed and configured properly, in addition to Open Ria Services and the Open Ria Services Toolkit. They also require installing and configuring SQL Server 2008 R2 Express with Advanced Services and installing the AdventureWorks OLTP and LT database.

Detailed instructions for the satisfaction of each of these prerequisites are provided by the topics within the node. Follow the instructions provided there before proceeding with this walkthrough to ensure that you encounter as few problems as possible when working through this Open Ria Services walkthroughs.

To create a solution

  1. In Visual Studio, select File, New, and then Project.

    The New Project dialog box appears.

  2. Select the Silverlight project type.

  3. Select the Silverlight Business Application template and name the application ExampleBusinessApplication.

  4. Click OK.

    Notice the project structure that is created. The Silverlight client project includes Silverlight pages in the Views folder. These pages enable logging in users and registering new users.

  5. In Solution Explorer, right-click the Silverlight client project and select Properties.

    The Silverlight tab of the project designer appears. At the bottom of the tab, notice that a Open Ria Services link exists between the client and server projects.

  6. Build and run (F5) the application.

    The home page of the application appears in your browser.

  7. Click the login link.

    The Login dialog box appears.

  8. Click the Register now link.

    The Register dialog box appears.

  9. Add values to register a new user.

  10. Click OK to create the new user.

    Notice that you are now logged in as the user you registered.

  11. Close the browser.

To use Windows Authentication

  1. In the server project, open the Web.config file.

  2. In the authentication element, set the mode property to Windows and remove the forms element.

  3. In the client project, open the code-behind file (App.xaml.cs or App.xaml.vb) for the App.xaml file.

  4. Public Sub New()
        InitializeComponent()
    
        Dim webContext As New WebContext()
        'webContext.Authentication = New FormsAuthentication()
        webContext.Authentication = New WindowsAuthentication()
        Me.ApplicationLifetimeObjects.Add(webContext)
    End Sub
    public App()
    {
        InitializeComponent();
    
        WebContext webContext = new WebContext();
        //webContext.Authentication = new FormsAuthentication();
        webContext.Authentication = new WindowsAuthentication();
        this.ApplicationLifetimeObjects.Add(webContext);
    }
  5. Build and run (F5) the application.

    Notice that you are now logged in with your Windows account. The Silverlight Business Application includes code in the Application_Startup method that attempts to load the user for Windows Authentication.

See Also

Tasks

In the constructor, uncomment the line that sets the property to and comment out the line that sets the property to .

Authentication
WindowsAuthentication
FormsAuthentication
Walkthrough: Displaying Data in a Silverlight Business Application
Walkthrough: Displaying Related Data in a Silverlight Business Application
Release Notes
Changelog
Authentication, Roles, and Profiles
Prerequisites for Open Ria Services
RIA_RegisterUser
Register dialog box
Business Application home page
Login dialog box
RIA_ServicesCreateBizApp