Enhance .NET applications with the Enterprise Library
Takeaway: Microsoft's Enterprise Library provides a set of tools that can add powerful features to your applications and reduce your workload. Read this .NET article to take a closer look at the Enterprise Library.
While the .NET platform provides a powerful set of tools and libraries to build robust applications, I am always amazed by the additional free add-ons provided by Microsoft. In my opinion, the most notable is the Enterprise Library. This set of application blocks developed by the patterns and practices group utilizes best practices for solving common problems. The result is less development time and subsequent costs. In this week's column, we take a closer look at the Enterprise Library.
Overview
This is Microsoft's follow-up to its initial offering of the individual components contained in the Enterprise Library. The previous incarnations were designed as well as released separately. The problem with this approach was that each application block included its own code for tasks common across all application blocks. This redundancy has been resolved with the Enterprise Library. It brings each application block together into a cohesive unit. Each application block uses similar design patterns as well as sharing deployment and configuration requirements. It includes the following seven application blocks:
- Caching: Allows developers to incorporate a local cache in their applications.
- Configuration: Allows applications to read and write configuration information.
- Cryptography: Allows developers to include encryption and hashing functionality in their applications.
- Data Access: Allows developers to incorporate standard database functionality in their applications.
- Exception Handling: Allows developers and policy makers to create a consistent strategy for processing exceptions that occur throughout the architectural layers of enterprise applications.
- Logging and Instrumentation: Allows developers to incorporate standard logging and instrumentation functionality in their applications.
- Security: Allows developers to incorporate security functionality in their applications. Applications can use it in a variety of situations, such as authenticating and authorizing users against a database, retrieving role and profile information, and caching user profile information.
The Enterprise Library is downloaded in a single self-installing executable. Therefore, you can install and compile the library with one click of your mouse. The result includes the library components as well as a slew of QuickStarts that include samples that clearly demonstrate each application block's usage. It is a great way to get a better idea of how or where to use them.
In addition, each application block utilizes instrumentation through performance counters, event log entries, and WMI (Windows Management Instrumentation) events so you can easily monitor an application as well as diagnose possible problems.
Installation and setup
Once you download and install the Enterprise Library, a whole new set of tools are available on your computer. Note that you can choose application blocks during installation so you only install what is necessary. The default installation directory is c:\Program Files\Microsoft Enterprise Library with a Microsoft patterns & practices entry added to the All Programs menu in Windows. This menu provides access to each application block as well as the QuickStarts samples. In addition, tools are available to install/uninstall related services, work with the security database console, view documentation, and work with the configuration GUI.
The application blocks maintain related data in XML configuration files: web.config (Web application) or app.config (desktop application). Previous versions of the application blocks forced you to work with these files by hand via your favorite editor. While this is still possible, the latest version includes a visual interface to make such changes.
Note: The performance counters and Instrumentation are enabled by default, but to make sure everything is registered, you'll need to run the Install Services script from the Start Menu or run installutil over each assembly. It is easy to disable instrumentation if you are deploying to an environment where the instrumentation (via a project's conditional compilation properties), but it requires the code to be recompiled.
Deployment
The assemblies produced by compiling the installed version of the Enterprise Library source code are not strong named. As a result, they cannot be installed in the GAC (Global Assembly Cache), nor will they have the other benefits associated with strong named assemblies.
The application blocks may be compiled and deployed in an application's directory structure. This simplifies deployment because you can install the entire application, including the application block assemblies, on the target computer by using the xcopy command.
However, if multiple applications on the same computer use Enterprise Library application blocks, you must install a copy of the assemblies in each application's folder hierarchy. If you do have multiple applications, you can sign the assemblies with a strong name key. As a result, you can then place the assemblies in the GAC and use it for deployment. In summary, you must consider several issues when deploying the application:
- Unless the Enterprise Library dll files are stored in the GAC, they must be distributed in the application'âs bin directory.
- While the app.config or web.config should be deployed just fine, the other config files require some manual steps; you must copy them manually to the application Bin directory. By default they are created and deployed to the application root directory.
Strengthen your applications
The Enterprise Library provides a powerful set of add-ons for the .NET Framework. It offers a set of well-designed and thoroughly tested application blocks that can be used to strengthen current or future applications. You can easily implement logging and caching as well as simplify database connections and exception management.
These are just a few of the features available via the Enterprise Library. If you haven't done so already, download and install it. Next week, we put portions of the library to work in sample applications.
Miss a column?
Check out the .NET Archive, and catch up on the most recent editions of Tony Patton's column.
SponsoredWhite Papers, Webcasts, and Downloads
- VMware DRS: Why You Still Need Assured Application Delivery and Application Delivery Networking F5 Networks
- Live Webcast: Adding Interactive Reporting to Your Applications: Challenges and Requirements BIRT Exchange (Actuate)
- How to disappoint your HIPAA auditors and gain the respect of your board of directors (Not necessarily in that order) DataMotion, Inc.
- Hospital Improves Internal Communication and Business Processes with New Intranet Microsoft
- F5 Demo: F5 and VMware Virtualization Technology F5 Networks
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

