A Common Scenario

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.

The latest Enterprise Library information can be found at the Enterprise Library site.

Over the many years that developers have been creating traditional executable applications, and more recently Windows Forms applications, they have evolved architectural patterns and design philosophies that simplify application development, reduce development time, minimize errors, and maximize the capabilities and manageability of applications. However, the advantages these approaches offer are not confined to traditional executable applications—they are equally valid in Web development, where applications continue to become larger, more complex, and increasingly mission-critical for organizations and governments.

Like traditional executable applications, Web applications contain crosscutting concerns such as logging, caching, validation, and exception management—the Policy Injection Application Block can help minimize the issues involved in implementing these features. This example shows a common scenario that contains all the aforementioned crosscutting concerns and uses the Policy Injection Application Block to implement them in a manageable and configurable way.

The example displays a single ASP.NET page that allows users to execute the following three functions, each of which calls a method in a separate business object class named CustomerModel:

  • Get a list of customers using the GetCustomerList method. This method takes no parameters and returns a DataSet instance that contains a list of all customers.
  • Find the name of a specific customer from their customer ID using the GetCustomerName method. This method takes a customer ID as a parameter and returns a string that contains the name of the specified customer.
  • Get all the available information about a specific customer using the GetCustomerDetails method. This method takes a customer ID as a parameter and returns a DataRow instance that contains details about the specified customer.

To allow the Policy Injection Application Block to create and attach a handler pipeline to the CustomerModel class, the business object class derives from MarshalByRefObject. An alternative approach would be to define an interface for the class, and use the interface as the basis for the application block to carry out the policy injection process.

Figure 1 illustrates the ASP.NET page displaying the list of customers (only the first few are visible in the screenshot).

Ff648362.PI-INTRO-CommonScenario1(en-us,PandP.10).gif

Figure 1
The list of customers displayed by the example ASP.NET application

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.

The latest Enterprise Library information can be found at the Enterprise Library site.
Show: