Click here to Skip to main content
15,885,032 members
Articles / Web Development / IIS

Skeleton for a Silverlight business application based on Ria Services and the Ria Services Class Library

Rate me:
Please Sign up or sign in to vote.
4.50/5 (7 votes)
7 Nov 2009CPOL13 min read 82.3K   1.5K   75  
This article presents the techniques and caveats of building Silverlight business applications. It describes breaking down applications into tiers, implementing a data access in N-tier applications, implementing a custom authentication, adding a support of https to Ria Services applications.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Ria.Data;
using System.Windows.Ria.Data;
using BASample.Data.DomainService;

namespace BASample.Silverlight
{
	/// <summary>
	/// Context for the RIA application.
	/// </summary>
	/// <remarks>
	/// This context extends the base to make application services and types available
	/// for consumption from code and xaml.
	/// </remarks>
	public sealed partial class RiaContext : System.Windows.Ria.RiaContextBase
	{

		#region Extensibility Method Definitions

		/// <summary>
		/// This method is invoked from the constructor once initialization is complete and
		/// can be used for further object setup.
		/// </summary>
		partial void OnCreated();

		#endregion


		/// <summary>
		/// Initializes a new instance of the RiaContext class.
		/// </summary>
		public RiaContext()
		{
			this.OnCreated();
		}

		/// <summary>
		/// Gets the context that is registered as a lifetime object with the current application.
		/// </summary>
		/// <exception cref="InvalidOperationException"> is thrown if there is no current application,
		/// no contexts have been added, or more than one context has been added.
		/// </exception>
		/// <seealso cref="Application.ApplicationLifetimeObjects"/>
		public new static RiaContext Current
		{
			get
			{
				return ((RiaContext)(System.Windows.Ria.RiaContextBase.Current));
			}
		}

		/// <summary>
		/// Gets a user representing the authenticated identity.
		/// </summary>
		public new UserIdentity User
		{
			get
			{
				return (UserIdentity)base.User;
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader www.maxpaulousky.com
Belarus Belarus
Max currently is a senior developer at software company.

He lives with his wife Tatiana and son Zakhar (4 yrs) in Minsk, Belarus, but they dream to live in New Zealand.

Comments and Discussions