Exception Handling QuickStarts

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.

The Exception Handling Basic QuickStart applications demonstrate some of the key features of the Exception Handling Application Block. They use a set of walkthroughs, which are implementations of the situations discussed in Key Scenarios. There are two QuickStarts:

The QuickStarts have the following features:

  • The scenarios are independent of each other. Therefore, you can view them in any order. Each scenario contains all of the exception handling code required to complete the scenario.
  • A separate class library project is included in both solutions to represent a separate application layer.
  • A routine is included that processes any unhandled exceptions that occur during one or more of the scenarios. The routine uses the Global Policy exception handing policy to display a dialog box that shows the exception message. This dialog box appears for the scenarios that propagate exceptions (whether they are unchanged, wrapped, or replaced). This routine helps illustrate the exception handling process.

The QuickStarts are provided in two versions. The first version of each one uses the factory approach to create Enterprise Library objects and the static methods. For example, it uses the static HandleException method of the ExceptionPolicy class to handle an exception, and creates an instance of the AppService class using the new operator.

The second version of each QuickStart demonstrates integration with the Unity Application Block. It creates and populates a UnityContainer instance with the data from the <unity> section of the configuration file. This loads the Enterprise Library Core and Exception Handling Application Block extensions. This QuickStart also generates the main form instance using the Resolve method of the UnityContainer, which causes Unity to create and inject an instance of the non-static ExceptionManager class and the AppService instance in the form constructor. The QuickStart then uses the methods of this instance to perform the tasks required. For example, it uses the HandleException method of the ExceptionManager class to handle an exception.

For information about integration with the Unity Application Block, and how you can create instances of Enterprise Library objects using Unity, see Creating Objects Using the Unity Application Block.