Developer's Guide to Microsoft Enterprise Library, 2nd Edition

patterns & practices Developer Center

On this page: Download:
Contents | About This Guide | What Does This Guide Cover? | What This Guide Does Not Cover | How Will This Guide Help You? | Who’s Who | What Do You Need to Get Started? | The Team Who Brought You This Guide | The Enterprise Library 6 Development Team

Download code

Download PDF

Download Paperback


About This Guide

When you casually pick up a book in your local bookstore or select one from the endless collection available on your favorite Web site, you're probably wondering what the book actually covers, what you'll learn from it, whether the content is likely to be interesting and useful, and—of course—whether it is actually any good. We'll have a go at answering the first three of these questions here. The final question is one only you can answer. Of course, we would be pleased to hear your opinion through our community Web site at

What Does This Guide Cover?

As you can probably tell from the title, this guide concentrates on how you can get started with Enterprise Library. It will help you learn how to use Enterprise Library in your applications to manage your crosscutting concerns, simplify and accelerate your development cycle, and take advantage of proven practices. Enterprise Library is a collection of prewritten code components that have been developed and fine-tuned over many years. You can use them out of the box, modify them as required, and distribute them with your applications. You can even use Enterprise Library as a learning resource. It includes the source code that demonstrates Microsoft .NET programming techniques and the use of common design patterns that can improve the design and maintainability of your applications. By the way, if you are not familiar with the term crosscutting concerns, don't worry; we'll explain it as we go along.

Enterprise Library is an extensive collection, with a great many moving parts. To the beginner, knowing how to best take advantage of it is not completely intuitive. Therefore, in this guide we'll help you to quickly understand what Enterprise Library is, what it contains, how you can select and use just the specific features you require, and how easy it is to get started using them. You will see how you can quickly and simply add Enterprise Library to your applications, configure it to do exactly what you need, and then benefit from the simple-to-use, yet extremely compelling opportunities it provides for writing less code that achieves more.

The first chapter of this guide discusses Enterprise Library in general, and provides details of the individual parts so that you become familiar with the framework as a whole. The aim is for you to understand the basic principles of each of the application blocks in Enterprise Library, and how you can choose exactly which blocks and features you require. Chapter 1 also discusses the fundamentals of using the blocks, such as how to configure them, how to instantiate the components, and how to use these components in your code.

The remaining seven chapters discuss in detail the application blocks that provide the basic crosscutting functionality such as data access, logging, and exception handling. These chapters explain the concepts that drove development of the blocks, the kinds of tasks they can accomplish, and how they help you implement many well-known design patterns. And, of course, they explain—by way of code extracts and sample programs—how you actually use the blocks in your applications. After you've read each chapter, you should be familiar with the block and be able to use it to perform a range of functions quickly and easily, in both new and existing applications.

This guide also includes a section called Tales from the Trenches, which contains case studies from the real world, including experiences of developers using Enterprise Library for the very first time. Additional case studies get posted online as they become available (, so make sure to check them out. If you want to share your story with the developer community at large, send a draft to and we'll work with you to get your story across.

Finally, the appendices present more detailed information on specific topics that you don't need to know about in detail to use Enterprise Library, but are useful as additional resources and will help you understand how features such as dependency injection, interception, and encryption fit into the Enterprise Library world.

All of the chapters include references to additional resources such as books, blog posts, and papers that will provide additional detail if you want to explore some of the topics in greater depth. For your convenience, there is a bibliography online that contains all the links so that these resources are just a click away.

You can also download and work through the Hands-On Labs for Enterprise Library, which are available at

What This Guide Does Not Cover

The aim of this guide is to help you learn how to benefit from the capabilities of Enterprise Library. It does not describe the common design patterns in depth, or attempt to teach you about application architecture in general. Instead, it concentrates on getting you up to speed quickly and with minimum fuss so you can use Enterprise Library to manage your crosscutting concerns.

Enterprise Library is designed to be extensible. You can extend it simply by writing custom plug-in providers, by modifying the core code of the library, or even by creating entirely new blocks. In this guide, we provide pointers to how you can do this and explain the kinds of providers that you may be tempted to create, but it is not a topic that we cover in depth. These topics are discussed more fully in the Enterprise Library Reference Documentation, and in the many other resources available from our community Web site at

For more information about the Dependency Injection (DI) design pattern and associated patterns, see "Chapter 2 – Dependency Injection" in the Unity Developer’s Guide.

How Will This Guide Help You?

If you build applications that run on the Microsoft .NET Framework, whether they are enterprise-level business applications or even relatively modest Windows Forms, Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), or ASP.NET applications, you can benefit from Enterprise Library. This guide helps you to quickly grasp what Enterprise Library can do for you, presents examples that show it in action, and make it easier for you to start experimenting with Enterprise Library.

The sample applications are easy to assimilate, fully commented, and contain code that demonstrates all of the main features. You can copy this code directly into your applications if you wish, or just use it as a guide when you need to implement the common functionality it provides. The samples are console-based applications that contain separate procedures for each function they demonstrate. You can download these samples from

Finally, what is perhaps the most important feature of this guide is that it will hopefully allay any fears you may have about using other people's code in your applications. By understanding how to select exactly the features you need, and installing the minimum requirements to implement these features, you will see that what might seem like a huge and complicated framework is actually a really useful set of individual components and features from which you can pick and choose—a candy store for the architect and developer.

Who’s Who

The guide includes discussions and examples that relate to the use of Enterprise Library in a variety of scenarios and types of application. A panel of experts provides a commentary throughout the book, offering a range of viewpoints from developers with various levels of skill, an architect, and an IT professional. The following table lists the various experts who appear throughout the guide.


Markus is a software developer who is new to Enterprise Library. He is analytical, detail-oriented, and methodical. He's focused on the task at hand, which is building a great LOB application. He knows that he's the person who's ultimately responsible for the code.

"I want to get started using Enterprise Library quickly, so I want it to be simple to integrate with my code and easy to configure with plenty of sensible defaults."


Beth is a developer who used Enterprise Library sometime ago but abandoned it in her more recent projects. She is interested in re-evaluating it but her primary concern is that it shouldn't be an all-or-nothing deal.

"I'm happy using libraries and frameworks but I don't want to get tied into dependencies that I don't need. I want to be able to use just the components I need for the task in hand."


Jana is a software architect. She plans the overall structure of an application. Her perspective is both practical and strategic. In other words, she considers not only what technical approaches are needed today, but also what direction a company needs to consider for the future. Jana has worked on many projects that have used Enterprise Library as well as other libraries. Jana is comfortable assembling a best-of-breed solution using multiple libraries and frameworks.

"It's not easy to balance the needs of the company, the users, the IT organization, the developers, and the technical platforms we rely on while trying to ensure component independence."


Carlos is an experienced software developer and Enterprise Library expert. As a true professional, he is well aware of the common crosscutting concerns that developers face when building line-of-business (LOB) applications for the enterprise. His team is used to rely on Enterprise Library and they are happy to see continuity in Enterprise Library releases. Quality, support, and ease of migration are his primary concerns.

"Our existing LOB applications use Enterprise Library for crosscutting concerns. This provides a level of uniformity across all our systems that make them easier to support and maintain. We want to be able to migrate our existing applications to the new version with a minimum of effort."


Poe is an IT professional who's an expert in deploying and managing LOB applications. Poe has a keen interest in practical solutions; after all, he's the one who gets paged at 3:00 AM when there's a problem. Poe wants to be able to tweak application configuration without recompiling or even redeploying them in order to troubleshoot.

"I want a consistent approach to configuration for all our applications both on-premises and in the cloud and plenty of flexibility for logging to make it easy to manage and troubleshoot our applications."

What Do You Need to Get Started?

The prerequisites for using this guide are relatively simple. You'll need to be relatively experienced in C#, and understand general object-oriented programming techniques. The system requirements and prerequisites for using Enterprise Library are:

  • Supported architectures: x86 and x64.
  • Operating system: Microsoft Windows 8 or 8.1, Microsoft Windows 7, Windows Server 2008 R2, Windows Server 2012.
  • Microsoft .NET Framework 4.5 or 4.5.1.
  • For a rich development environment, the following are recommended:
    • Microsoft Visual Studio 2012 or 2013, Professional, Ultimate, or Express editions.
  • For the Data Access Application Block, the following is also required:
    • A database server running a database that is supported by a .NET Framework 4.5 data provider.
  • For the Logging Application Block, the following are also required:
    • If you are using the Message Queuing (MSMQ) Trace Listener to store log messages, you need the Microsoft Message Queuing (MSMQ) components installed.
    • If you are using the Database Trace Listener to store log messages, you need access to a database server.
    • If you are using the E-mail Trace Listener to store log messages, you need access to an SMTP server.
  • For the Semantic Logging Application Block, the following may be required:
    • If you are using the SQL Database Sink to store log messages, you need access to a SQL Server database server.
    • If you are using the Microsoft Azure Sink to store log messages, you need access to an Azure storage account. You must also install the Azure SDK Version 1.8.

You can use the NuGet package manager in Visual Studio to install the Enterprise Library assemblies that you need in your projects.

Other than that, all you require is some spare time to sit and read, and to play with the example programs. Hopefully you will find the contents interesting (and perhaps even entertaining), as well as a useful source for learning about Enterprise Library.

The Team Who Brought You This Guide


Grigori Melnik


Dominic Betts, Julián Domínguez, Alex Homer, Hernan de Lahitte, Grigori Melnik, Fernando Simonazzi, and Mani Subramanian

Foreword by

S. Somasegar

Foreword to the 1st edition by

Scott Guthrie

Technical Reviewers

Fabian Fernandez, Mariano Grande, Randy Levy, Vladimir Melnik, and Dan Piessens

Graphic Artist and Book Layout

Chris Burns

Cover Design

Grigori Melnik, Masashi Narumoto, RoAnn Corbisier, Nelly Delgado and Chris Burns


RoAnn Corbisier


Nelly Delgado

The Enterprise Library 6 Development Team

Product/Program Management

Grigori Melnik (Microsoft Corporation).


Julian Dominguez (Microsoft Corporation), Fernando Simonazzi and Edgardo Rossetto (Clarius Consulting), and Hernan de Lahitte (Digit Factory)


Mani Subramanian (Microsoft Corporation), Mariano Grande (Digit Factory), Rathi Velusamy, Lavanya Selvaraj, and Shebu Kollam Valappil (Infosys Technologies Ltd.)

Performance/Security Testing

Carlos Farre (Microsoft Corporation), Naveen Pitipornvivat and Soranai Chantarayotha (Adecco)


Dominic Betts (Content Master Ltd), Grigori Melnik, Julian Dominguez and Mani Subramanian (Microsoft Corporation), and Fernando Simonazzi (Clarius Consulting)

Editing/Pre- and Post Production

RoAnn Corbisier, Nelly Delgado, Handan Selamoglu and Jane Sinyagina (Microsoft Corporation), Chris Burns (Linda Werner & Associates)

Release Management

Nelly Delgado and Grigori Melnik (Microsoft Corporation)

Advisory Council

Fabian Fernandez Bargas (TellMi), Joseph M. Blank (Online Business Systems), Bryan Clark (Ethos Solutions), Gabriele Giuseppini (Optiver Holding B.V.), Deon Heyns, Matt Kean (Caterpillar Inc), Ercenk Keresteci and Trent Swanson (Full Scale 180, Inc.), Randy Levy, Jeremy Likness (Wintellect), Andrei Marukovich (AB SCIEX), Ksenia Mukhortova (Intel), Peter Nilsson (Volvo Information Technology AB), Dan Piessens (Centare), Peter Ritchie (Peter Ritchie Inc.), Luke G. Sigler (Qualcomm Life), Jon Wagner (eMoney Advisor), Sebastian Weber, Bill Wilder (DevPartners), Matias Woloski (Auth0), Walter Wu (Royal Bank of Canada), Nuno Centeno, Jason Hogg, Tom Hollander, Robert Jarratt, Michael Lanzetta, Valery Mizonov, Rafael Fernandez Moctezuma, Tyler Ohlsen, Timothy Stockstill, Christopher Tavares, Michael Thomassy, and Rob Vettor (Microsoft Corporation)


Attendees at patterns & practices summits and symposia, //Build, TechReady, and TechEd conferences who provided informal feedback; and Unity users who commented on this guide on CodePlex, through our blogs, surveys and via e-mail. Thank you!

Next Topic | Home | Community