Export (0) Print
Expand All
4 out of 6 rated this helpful - Rate this topic

User Interface Process Application Block for .NET

 

Retired Content
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

patterns & practices Developer Center

Related Links

patterns and practices Index

.NET Architecture Center

Application Architecture for .NET: Designing Applications and Services

By Edward Jezierski (Microsoft Corporation), Michael Stuart (Microsoft Corporation), Lin Joyner (Content Master Ltd), and Pablo Cibraro (Lagash Systems)

June 2003

Summary: The User Interface Process Application Block provides a simple yet extensible framework for developing user interface processes. It is designed to abstract the control flow and state management out of the user interface layer into a user interface process layer. This enables you to write generic code for the control flow and state management of different types of applications (for example, Web applications and Windows-based applications) and helps you write applications that manage users' tasks in complex scenarios (for example, suspending and resuming stateful tasks). This leads to simpler development and maintenance of complex applications. The User Interface Process Application Block can easily be used as a building block in your own .NET application. (11 printed pages)

Contents

Versions of the UIP Application Block

There are two versions of the UIP Application Block. Version 1.0 was released in June 2003 and version 2.0 was released in April 2004. The block provides you with a number of features that will help you develop user interface process components, and therefore distributed applications, more efficiently. The following features are in the first version of UIP and continue to be part of UIP version 2.

  • Web session resume
  • Web session transfer
  • Reuse of code between application types
  • Development of discrete tasks
  • Storage of state in state persistence providers

The following features are new to UIP version 2:

  • Expanded navigation management
  • Additional state persistence providers
  • Layout managers
  • Enable back-button support
  • Usability enhancements

Microsoft Visual Basic® .NET and Microsoft Visual C#® .NET source code is supplied for version 1.0 of the UIP Application Block, together with QuickStart sample applications in each language that you can use to test common scenarios.

For version 2.0 of the UIP Application Block, only Microsoft Visual C#® .NET source code is provided. However, the QuickStarts are supplied in both Microsoft Visual Basic® .NET and Microsoft Visual C#® .NET languages. Version 2.0 of the UIP Application Block features significant functionality and usability enhancements over version 1.0.

Click here for more information on version 2.0 of the UIP Application Block.

Introduction

Are you involved in the design and development of user interface processes for complex .NET applications? Have you ever felt that you spend too much time writing and updating user interface processes? Have you ever felt that you repeatedly write the same user interface workflow paths for different application types? If so, the User Interface Process Application Block for .NET is for you.

The User Interface Process Application Block is a user interface process framework that enables you to easily write complex user interface navigation and workflow processes that can be reused in multiple scenarios and extended as an application evolves. It can easily be used as a building block within your own .NET applications. If you use it, you will reduce the amount of custom code you need to create, test, and maintain.

Specifically, the User Interface Process Application Block helps you:

  • Separate the control flow (navigation) from the pages, forms, and controls that the user interacts with.
  • Abstract state management for a use case from the forms and controls working on that data.
  • Use the same programming model for the code that manages control flow and state for different types of applications, including Windows-based applications, Web applications, and device applications.
  • Write applications that manage users' tasks in complex scenarios; for example, reassigning tasks to different users or letting a user resume interrupted tasks.

For example, in an application that references the User Interface Process Application Block, you can move from one view to another using two lines of code, as shown in the following code.

[Visual Basic]
Public Sub ResumeShopping()
  ' proceed to next View
  State.NavigateValue = "resume"
  Navigate()
End Sub

[C#]
public void ResumeShopping() 
{
  // proceed to next View
  State.NavigateValue = "resume";
  Navigate();
}
Note   This Application Block for .NET has been designed based on reviews of successful .NET applications. It is provided as source code that you can use "as-is" or customized for your application. It is not an indication of future direction for user interface processes within the Microsoft .NET Framework. Future releases of the .NET Framework may address user interface processes using a different model.

The remainder of this overview is divided into the following sections:

What Does the User Interface Process Application Block Include?

Downloading and Installing the User Interface Process Application Block

Using the User Interface Process Application Block

Frequently Asked Questions

Feedback and Support

Collaborators

What Does the User Interface Process Application Block Include?

The source code for the User Interface Process Application Block is provided, together with QuickStart sample applications, which you can use to test its functionality. The User Interface Process Application Block also includes comprehensive documentation to help you work with and learn about the code provided.

The Visual Studio .NET Projects

Microsoft Visual Basic® .NET and Microsoft Visual C#® .NET source code is supplied for the User Interface Process Application Block, together with QuickStart Sample applications in each language that you can use to test common scenarios. This helps increase your understanding of how the User Interface Process Application Block works. You are also free to customize the source code to suit individual requirements.

Both the Visual Basic .NET and C# version of the Microsoft.ApplicationBlocks.UIProcess projects can be compiled to produce an assembly named Microsoft.ApplicationBlocks.UIProcess.dll. This assembly contains all the classes and interfaces that comprise the block.

The download also contains the following QuickStart projects:

  • Microsoft.ApplicationBlocks.UIProcess.Quickstarts.MultiNavGraph

    This QuickStart shows how to link tasks in an application that uses multiple navigation graphs.

  • Microsoft.ApplicationBlocks.UIProcess.Quickstarts.Store

    This QuickStart includes a Web application and a Windows-based application of an e-commerce store using the User Interface Process Application Block.

  • Microsoft.ApplicationBlocks.UIProcess.Quickstarts.Wizard

    This QuickStart shows how to develop a wizard application using the User Interface Process Application Block.

The Documentation

Comprehensive documentation is provided. This includes the following main sections:

  • Design of the User Interface Process Application Block – This section includes background design philosophy information that provides insights into the design and implementation of the User Interface Process Application Block.
  • Developing Applications with the User Interface Process Application Block – This section includes information that helps you develop applications using the User Interface Process Application Block quickly and easily. It shows how to use both the basic features of the block and how to customize the block components for individual situations.
  • Deployment and Operations – This section includes installation information; it describes deployment options and use of the global assembly cache. It also includes security recommendations.
  • Reference – This is a comprehensive API reference section that details the classes and interfaces comprising the User Interface Process Application Block.

System Requirements

To run the User Interface Process Application Block, you need the following:

  • Microsoft Windows® 2000, Windows XP Professional, Microsoft Windows Server 2003
  • Microsoft .NET Framework version 1.1
  • Visual Studio .NET 2003 (recommended but not required)

Downloading and Installing the User Interface Process Application Block

A Windows Installer file containing the User Interface Process Application Block projects, source code and comprehensive documentation is available.

The install process creates a Microsoft Application Blocks for .NET submenu on your Programs menu. On the Microsoft Application Blocks for .NET submenu, there is a User Interface Process submenu that includes options to launch the documentation, to install the demonstration applications, and to launch the User Interface Process Application Block Visual Studio .NET solutions.

After you install the User Interface Process Application Block, you should install the QuickStart applications using the Install Demos option on the User Interface Process submenu. This configures Microsoft Internet Information Server, creates SQL Server™ databases, and configures secure state persistence. You can remove the QuickStart applications from your computer using the Uninstall Demos option on the User Interface Process submenu. To learn more the install script, see the Readme.txt file in the application installation folder.

Click here to open the MS.com download page.

Using the User Interface Process Application Block

This section describes how to use the basic features of the User Interface Process Application Block. Additional information about these and other related topics can be found in the documentation included with the User Interface Process Application Block download.

The User Interface Process Application Block is designed to make the development and maintenance of the user interface layer of a complex application easier to manage. It covers a number of use cases:

  • Resuming Web sessions – This enables users to close browser sessions, and then later return to them with the ability to resume where they left off.
  • Transferring Web sessions – This enables one user to suspend a session, and another user to pick it up on another computer or one user to suspend a session on one device, and resume it on a different type of device.
  • Reuse of code between application types – This enables you to port the user interface process control logic from one type of application to another (for example, from a Windows-based application to a Web application).
  • Development of wizard-based applications – This enables you to reuse configuration information and code throughout a wizard-type application that uses the same style of Next and Back buttons throughout the process and that requires the storage of state until the end of the process.
  • Development of create, read, update, delete (CRUD) applications – This enables you to develop the standard user interface process of a CRUD application and reuse that code in many applications.
  • Development of discrete tasks – This enables you to develop encapsulated tasks (for example, a Register User task and a Checkout task) that can be linked together to complete a job. You can pass information between tasks as required (for example, you can pass user details to the Checkout task).

The main elements of the User Interface Process Application Block are illustrated in Figure 1.

Ee817680.f01uipb01(en-us,PandP.10).gif

Figure 1

The User Interface Process Application Block

The user interface components that you develop for your application must either implement the IView interface provided in the User Interface Process Application Block or be based on one of the two implementations of that interface provided for use with Web applications (WebFormView) and Windows-based applications (WinFormView). You can use the IView interface to develop views for any application type that you require; for example, a .NET Compact Framework application.

Figure 1 shows that you develop your views to interact with a controller class (or classes), which are the main control mechanism between users and the application. Your controller classes are based on the ControllerBase class provided in the User Interface Process Application Block and should contain the following:

  • Navigation methods that are called by the user interface components to coordinate the path of the user through the application
  • Functional methods that are called by the user interface components to do their work
  • State methods that store information in the persistent storage device

The controller is a facade to the application's underlying business components, mediating communication between the user interface layer and the business components, while also controlling the user interface workflow.

The controller communicates with many of the User Interface Process Application Block components. It can store user interface process information and application-specific information in the State object. The contents of the State object can be also be stored in an external location using a state persistence provider. The User Interface Process Application Block ships with persistence providers for SQL Server databases, memory, and the ASP.NET Session object. You can also create your own classes by deriving from the IStatePersistence interface.

The controller also communicates with the internal UIPManager class. This class is used to manage the user interface process; it dispenses controllers to views, generates new views, coordinates tasks, and provides workflow based navigation.

As you can see, there are many configurable options in a User Interface Process Application Block application; for example, the class to use for the controller or the type of state persistence provider to use. These options are configured on an application basis in the application configuration file. This file contains a uipConfiguration element that defines the types to be used for the main objects, the types to be used for the views, and the navigation graphs that define the flow of the user process. The UIPManager class uses information from this file to determine the classes to use and the views to display.

Developing Applications Using the User Interface Process Application Block

There are a number of steps that you must follow to successfully develop an application using the User Interface Process Application Block.

Planning the Application

Before you begin coding your application, you must consider the requirements of the use cases of your application in order to translate them into an appropriate User Interface Process Application Block configuration. The specific tasks you must undertake are:

  1. Separating the application into distinct use cases – Applications are usually comprised of many use cases. By separating the use cases correctly, you gain better reusability because each use case is encapsulated.
  2. Designing a flow diagram for each use case – The flow of the user interface process in a User Interface Process Application Block application is controlled by a series of navigation graphs which can be represented by flow diagrams. You should draw each use case as a flow diagram of views, using the output of each view to lead to the next view and the output of each use case to lead to the next use case.

You should also undertake the usual planning tasks that are essential to the successful development of an application.

Developing the Application

After you have a plan for the flow of control through your application you can begin coding the constituent parts. The development of an application using the User Interface Process Application Block includes the following steps:

  • Creating the controller – Your controller classes are the main control mechanism between the user and the application. You should write methods in the controller classes to navigate between views, navigate between navigation graphs, call the application specific functions, and store user interface process state.
  • Starting a task – The first view in an application generally calls the UIPManager.StartTask method to initiate the workflow path defined in the configuration file. This overloaded method can take a number of parameters including the name of the navigation graph to use, the task identifier of an existing task, the parent form for a multiple document interface (MDI) child form.
  • Creating the views – Views that are controlled by the User Interface Process Application Block must either implement the IView interface or inherit from a class that implements it. For standard Web and Windows-based applications, you can inherit from the WebFormView and WinFormView classes provided in the block.

    To implement navigation between views you simply call the navigation methods that you have defined in your controller classes.

  • Creating the configuration file – The configuration file must contain a uipConfiguration element that matches the schema defined in the UIPConfigSchema.xsd file in the User Interface Process Application Block.

    This configuration section should define the following:

    • The name and type of the view manager to be used
    • The name and type of the state class to be used
    • The name and type of the controller(s) to be used
    • The name and type of the state persistence provider to be used
    • The names and types of each view in the application along with the controller that each uses
    • Navigation graphs for each use case defining the flow between the views in the use case

These steps detail how to use the classes provided in the User Interface Process Application Block. However, there are times when you may want to customize one or more of these classes to meet your individual requirements.

Customizing the Block Components

Using the User Interface Process Application Block in a default configuration works well for most scenarios. However, there are times when you may want to customize certain parts of the block to be more specific to your applications needs.

Customizing State Management

If you want to use a different type of store for your state persistence, you can create your own implementation of the IStatePersistence interface. The block contains examples for using SQL Server, memory, and the ASP.NET Session object. You can use these to guide you in the customization process.

Another way to customize the state management in your application is to use your own implementation of the State class that uses strongly-typed data types. The best way to do this is to inherit the existing State class from within the block, and then to add custom properties where required.

By default, the User Interface Process Application Block persists state every time the user changes view. While this results in a highly scalable application, it does not result in good performance. You may decide to only persist the data when you know that particular parts of it have changed to improve the performance of the application. You can do this by creating your own implementation of the State class and adding an IsDirty property to it.

Alternatively, you may decide against using the State object for application data. If you are using high-scale online transaction processing that has been designed to use a stateless middle tier, storing application data in the State object directly contradicts the original design of a stateless middle tier. This design is generally used to increase scalability while accepting a per user performance degradation.

Customizing View Management

The User Interface Process Application Block contains view implementations for both Windows Form views and ASP.NET Web Form views. If you want to use a different type of view implementation, you need to implement some of the view interfaces.

Creating custom views and view management classes is not a simple process and should only be undertaken when strictly necessary. There are two main scenarios when you may decide to do this:

  • The User Interface Process Application Block contains view and view management implementations for use in Windows-based applications and ASP.NET Web applications. If you want to use other types of user interface for your views, you must customize the view system.
  • The .NET Framework allows you to derive a class from many interfaces, but only one class. If your views must derive from a standard class, they cannot also derive from WebFormView or WinFormView. In this scenario, you must implement the IView interface in a base view, and then derive your individual views from it.

Creating your own view classes involves more than just implementing the IView interface in a class and deriving views from that class. You must also implement your own view management class (using IViewManager) and write custom code for the creation and manipulation of your views.

Frequently Asked Questions

What types of application can I use the User Interface Process Application Block with?

Any! The User Interface Process Application Block contains view implementations for Web applications and Windows-based applications, but you can develop custom view implementations for whatever application type you require.

Do all the tasks in my application have to use the same state and state persistence provider implementations?

No. If you divide your process into use cases and create a navigation graph for each use case, each task can use different state implementations. This is because the classes to be used are specified on a per navigation graph basis.

Why should I use multiple navigation graphs within one application?

You could use one large navigation graph for the whole application; however, this goes against the design principles of encapsulating each use case within a navigation graph. By separating them out, you gain reusability of tasks and simplification of coding.

Can I use non-SQL Server databases for storing state?

Yes. All you need to do is implement the IStatePersistence interface to communicate with whatever storage mechanism you prefer.

Can I use XCOPY deployment to deploy the User Interface Process Application Block assembly?

Yes. After it is compiled, the Microsoft.ApplicationBlocks.UIProcess.dll assembly can be XCOPY deployed.

Are there any other application blocks?

Yes. The User Interface Process Application Block is one of several Application Blocks that are being released. These Application Blocks solve the common problems that developers face from one project to the next. They can be plugged into .NET applications quickly and easily.

Feedback and Support

Questions? Comments? Suggestions? For feedback on the User Interface Process Application Block, please send an e-mail message to devfdbck@microsoft.com.

The Application Blocks for .NET are designed to jumpstart development of .NET distributed applications. The sample code and documentation is provided "as-is." Support is available through Microsoft Product Support for a fee.

The GotDotNet community site provides a place for .NET developers to share code and ideas. A GotDotNet workspace for the User Interface Process Application Block has been created at http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=0af2b0ef-b049-401a-a2f2-f55a070c1572. Please share your Updater Application Block questions, suggestions, and customizations with the community in this workspace.

A newsgroup has also been created to assist you with the Application Blocks for .NET. Use this newsgroup to consult with your counterparts, peers, and Microsoft Support Professionals in an online, open forum.

Everyone else benefits from your questions and comments, and our development team is monitoring the newsgroup on a daily basis: Newsgroup: Web-Based Reader http://www.microsoft.com/communities/newsgroups/default.mspx

Newsgroup: NNTP Reader news://msnews.microsoft.com/Microsoft.public.dotnet.distributed_apps

Do you want to learn and harness the power of .NET? Work side by side with technology experts at the Microsoft Technology Centers to learn development best practices. For more information, please visit http://www.microsoft.com/business/services/mtc.asp.

Collaborators

Many thanks to the following contributors and reviewers:

Alfredo RamirezKostas Williams
Anders HeickKunal Jain (Infosys Technologies Ltd)
Angela CrockerLynne C. Lafleur
Areeb AfsahMark (Inkmarc)
Arvindra SehmiMartin Born
Avi Ben-MenahemMatt Morris
Bijan JavidiMichael Dereszynski
Brenton WebsterMichael Freifeld
Brian HodgdonMichael Kogotkov
Brian LoomisMichael Monte
Chaitanya Bijwe (Infosys Technologies Ltd)Michael Thomassy
Chris CichockiMichel Baladi
Chris CraftMike Benson
Chris HenryMohamed Ayadi
Chris SchoonNathan Hanks
Chris WaferNeil Peterson
Clementino MendoncaNiroo Thaya-Paran
Craig HuberOmri Toppol
Dan GreenPablo Degrande
David BroussardPatrick Long (Charteris)
David TrowbridgePaul Hoeffer
David WellerPeter Freeborn
Deborah KurataPeter Ho
Dimitris GeorgakopoulosPeter Russo
Dwight SmithPeter Tsang
Ed DraperPhilip Ochu
Eric ThomasPhilip Reilly
Eugenio PacePhilip Teale
Evald MarkinzonPrashant Bansode (Infosys Technologies Ltd)
Florent MatheryRick Harris
Francisco SalgueroRick Kopitzke
Franco A. CerutiRob Howard
Gareth JonesRobert Moore
George MondragonRohit Sharma (Infosys Technologies Ltd)
Geralyn MillerRonald Kegge
Greg BybeeRoss Cockburn
Gregg HansenSameer Aras (Infosys Technologies Ltd)
Gregory KieferScott Bellware
Hanu KommalapatiScott Densmore
Hemang Naik (Infosys Technologies Ltd)Shanku Niyogi
Irving De La CruzSharon Bjeletich
J Sawyer, Jr.Shawn Cole
Jaidesh Sethi (Cohesion)Shawn Farkas
James BollesSrinath Vasireddy
Jamie CoolSrinivas Bontu
Jasen TenneyStephen Fulcher
Jasone CerasiaSteve Busby
Jay LewisSteven Huang
Jay SkellySunit Carpenter
Jeff LittrellTim Mallalieu
Joe CastroTim Pearson
Joe StegmanTom Gagne
John LarrisonTom Kudla
John MartinTorben Pedersen
John MillerVarsha Patil (Infosys Technologies Ltd)
John OpalkoVidyuth Muthanna
Kenny JonesWilliam Hertha
Kevin S RobertsWilliam Leary
Kliment MamykinZhanbo Sun

Thanks, also, to the content team: Edward Lafferty, Sameer Tarey (Infosys Technologies Ltd), Ashish Babbar (Infosys Technologies Ltd), Tina Burden (Entirenet), and Kathy Ferguson (Entirenet).

patterns & practices Developer Center

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.