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 QuickStart application demonstrates some of the key features of the Caching Application Block. It uses a set of walkthroughs to demonstrate these features. The following walkthroughs are implementations of the situations discussed in Key Scenarios:
- Walkthrough: Adding Items to the Cache
- Walkthrough: Removing Items from the Cache
- Walkthrough: Retrieving Items from the Cache
- Walkthrough: Flushing the Cache
- Walkthrough: Loading the Cache
The QuickStart uses a top-level handler to catch any exceptions that occur during any of the scenarios. The handler displays a dialog box with the exception message.
The QuickStart does not require you to perform any setup procedures prior to building and running the application.
The QuickStart is provided in two versions. The first uses the factory approach to create Enterprise Library objects. For example, it creates a CacheManager instance using the CacheFactory.GetCacheManager method, and creates a ProductData instance using the new operator.
The second version 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 Caching 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 the required CacheManager and ProductData instances in the form constructor.
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.
|The default configuration of the QuickStart does not use a persistent backing store.|
The QuickStart ships as source code, which means you must compile it before running it. You build the QuickStart using Visual Studio.
To build the Caching QuickStart
- Ensure the Enterprise Library Source Code has been installed.
- Open the Enterprise Library Source Code folder from Windows Explorer or from the Start menu. To open it from the Start menu, click Start on the taskbar, point to All Programs, point to Microsoft patterns and practices, point to Enterprise Library 4.1 — October 2008, and then click Enterprise Library 4.1 Source Folder.
- To run the factory version of the QuickStart, open the QuickStarts folder, open the Cache folder, and then open the CS folder (for C#) or the VB folder (for Visual Basic .NET).
- To run the version of the QuickStart that demonstrates integration with the Unity Application Block, open the QuickStarts folder, open the Cache folder, and then open the CS-UnityIntegration folder (for C#) or the VB-UnityIntegration folder (for Visual Basic .NET).
- Double-click the CachingQuickStart.sln solution file.
- Visual Studio opens, displaying the solution file. On the Build menu, click Rebuild Solution. By default, this is a debug build.
- Press F5 to run the QuickStart.
The QuickStart configuration information is located in the same directory as the QuickStart project. It has the following attributes:
- The cache manager for the caching operations section is named "Default Cache Manager." The cache manager for the section on loading the cache proactively and reactively is named "Loading Scenario Cache Manager."
- Data is written only to the in-memory cache (not to a backing store).
- Expiration cycles occur every 60 seconds.
- Scavenging occurs when there are 1000 items in the cache.
- Scavenging removes 10 items from the cache.
The walkthroughs in this QuickStart are shipped with a defined configuration, which is included in the App.config file. This file is located in the same folder as the QuickStart project file. Each time you build the code, Visual Studio copies the App.config file to the output directory for the project (the same directory where the QuickStart executable is created), and renames it to CachingQuickStart.exe.config.
To change or view these settings, use the Enterprise Library Configuration Console to open the App.config file in the directory containing the QuickStart project file. The App.config file contains the configuration data.
You can also change the application configuration when you do not plan to recompile the application by opening the CachingQuickStart.exe.config file with the Enterprise Library Configuration Console. However, these changes will be overwritten during the next successful build.