Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Architecture
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
Bing
BizTalk
Book Excerpts
Build and Deploy
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Design Patterns
Development Process
Display Technologies
Distributed Computing
DotNetNuke
DSL
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
Internet Explorer 8.0
Interviews
iPhone
Iron Ruby
Java
Java Script
jQuery
LINQ
Linux
Mac OS X
MDX
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
Network
NHibernate
Object Oriented Development
Odata
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Python
Q&A
Rails
Rake
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Search
Security
Services
SharePoint
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
Tips
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WF
Whitepapers
Windows 7
Windows Azure
Windows Live
Windows Server
Windows Vista
WinForms
Workflow
WPF
XAML
XML
XNA
XSLT



Virtual Brown Bag Lunches


 


iPhone iPad Developers Conference


Reader rating:
Click here to read 1 comment about this article.
Article source: CoDe (2009 Jul/Aug)


Article Pages:  1  2 - Next >


RIA Services: RAD for the Middle Tier

RIA Services is a new Microsoft framework for developing n-tier Line of Business (LoB) applications. RIA Services make it easier to build Silverlight applications that communicate with a server, which is the focus of this article. As a developer, RIA Services provides automatic code generation for common scenarios where you need to perform CRUD

operations on data and have a consistent model to validate data across tiers. The following sections explain how to get started with RIA Services, specify a data source and a UI, and automatically generate code for CRUD operations. Let me show you the big picture of RIA Services from an architectural perspective first.

Understanding RIA Services Architecture

RIA Services solves problems in n-tier application design for Silverlight applications by making it easier to serialize and stream objects across a network, sharing common validation among tiers, and automating asynchronous communication. To compare current development practices to what RIA Services offers, consider a common architecture, shown in Figure 1, using Web services to allow a Silverlight application to communicate with the server.

Click for a larger version of this image.

Figure 1. N-Tier architecture with Web services.

To the left of Figure 1 is a Silverlight control in a browser, which is the presentation tier. Following the network connection to the right, the Web service resides on the server, which is a separate tier where Business Logic Layer (BLL) and Data Access Layer (DAL) code reside; the sidebar, Layers and Tiers, explains the difference between layers and tiers.

LoB application development is very much about managing data properly. In the Web services scenario in Figure 1, you can see how data management must be handled in each tier. Perhaps you have a framework that makes it easier to stream data across the wire, but you still have manual work to do in each tier to manage CRUD operations.

Observe in Figure 1 the separate validation code in each tier of the application, because in many cases you can’t make the assumption that presentation tier validation is sufficient. Especially in a Web services scenario, any client can send bad data.

A common problem with network communications is timeouts and managing perceived performance in the presentation tier in the face of latency. A common way to handle this is via asynchronous calls where your thread returns to the UI immediately and the application later handles the return thread from the Web service and marshals the call back onto the UI thread to update the screen. There are patterns and framework support for managing this, but you must write the code yourself. The solid line between tiers demonstrates the fact that communication is synchronous by default.

"
“Up to now, developers have been fortunate to have the tools to build sophisticated n-tier architectures easier than earlier generations of software technology. However, this scenario becomes even easier with RIA Services.”
"

Up to now, developers have been fortunate to have the tools to build sophisticated n-tier architectures easier than earlier generations of software technology. However, this scenario becomes even easier with RIA Services. Figure 2 shows how RIA Services simplifies data management, validation, and communications.

Click for a larger version of this image.

Figure 2: RIA Services architecture.

The single Data Objects block in Figure 2 demonstrates that the UI and BLL/DAL tiers use the same objects. RIA Services supports LINQ to SQL, ADO.NET Entity Framework, and POCO out of the box, reducing the amount of work that you must do to move data across the network. Similarly, Validation has a single block, showing that the same validation rules defined in the BLL will be used in the UI. RIA Services build a proxy for the UI layer to encapsulate asynchronous communication, represented by the dashed line between UI and middle tier, freeing you from the extra coding.

The rest of this article shows you how RIA Services can help reduce the amount of code you write for n-tier LoB applications, starting with an explanation of how to start a Silverlight project that uses RIA Services.

Starting RIA Services in a Silverlight 3 Project

The easiest way to use RIA Services is via the Silverlight Application wizard in Visual Studio 2008. The following steps will walk you through the process of creating a Silverlight application that uses RIA Services. For this article I’ll use a C# project, but you can do the same with a Visual Basic project:

  1. Start a new Silverlight application by selecting File | New | and Project. You’ll see the New Project window in Figure 3.
  1. Select Visual C#, select Silverlight in Project types, and select Silverlight Application in Templates.
  2. Set Name to RIAServicesDemo, specify the Location where you want the project to reside, and click OK. You’ll see the New Silverlight Application window in Figure 4.

Click for a larger version of this image.

Figure 3: New Project window.

Click for a larger version of this image.

Figure 4: New Silverlight Application window.

If you’ve built Silverlight applications before, the New Silverlight Application window in Figure 4 will be familiar. The Host the Silverlight application in a new Web site check box creates a new ASP.NET Web site with sample pages containing the new Silverlight control. You can change the project name to anything you like, but this demo will use the default. This demo will also use the default of ASP.NET Web Application Project as the project type; the alternative being an ASP.NET Web Site project. What’s new, for Silverlight 3, in the New Silverlight Application window is the Link options section. To use RIA Services, you must check the box for Link to ASP.NET server project, which establishes the proper assembly references and any other settings required for using RIA Services. If you forget to check the Link to ASP.NET server project box and change your mind later, you can open the Properties window for the Silverlight project and there is an option called ASP.NET server project link on the Silverlight tab that you can change.

  1. Click OK to create a new solution with a Silverlight application project and an ASP.NET project, shown in Figure 5.

Click for a larger version of this image.

Figure 5: New RIA Services application solution.

A couple items in Figure 5 are worthy of mention: assembly references and Toolbox controls. Notice that the Silverlight project, RIAServicesDemo, includes a reference to System.Windows.Ria; the assembly containing RIA Services types. In addition, you can see several new controls in the Toolbox such as DataForm, DataPager, and DatePicker that are new in Silverlight 3.

There are more new controls, many that are members of the Silverlight Toolkit, which is a set of LoB controls for Silverlight 2 available at http://silverlight.codeplex.com. Later sections of this article will introduce you to a couple of the new data controls.

"
“RIA Services supports multiple types of DAL in your architecture, including LINQ to SQL, LINQ to Entities, or custom.”
"

&

By: Joe Mayo

Joe Mayo is an author, independent consultant, and trainer specializing in .NET technologies. He operates the C# Station Web site (www.csharp-station.com) and is a Microsoft Most Valuable Professional (MVP). Joe is author of C# Unleashed (Sams) and C#Builder Kick Start (Sams). For more information about Joe, please visit www.mayosoftware.com.

jmayo@MayoSoftware.com



Article Pages:  1  2 - Next Page: 'Adding a Middle Tier with Domain Service' >>

Page 1: RIA Services: RAD for the Middle Tier
Page 2: Adding a Middle Tier with Domain Service

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
2.9 out of 5

11 people have rated this article.

      INSTANTLY dtSearch® TERABYTES OF TEXT

 

INSTANTLY dtSearch® TERABYTES OF TEXT