Enterprise Library 6 – April 2013
patterns & practices Developer Center
Microsoft Enterprise Library is a collection of application blocks designed to assist developers with common enterprise development challenges. Application blocks are a type of guidance, provided as source code that can be used "as is," extended, or modified by developers for use in their development projects.
Via NuGet (inside Visual Studio, use the NuGet package manager and search for “enterpriselibrary”)
Microsoft Enterprise Library 6
Developer’s Guide to Microsoft Enterprise Library (2nd edition)
Additional Learning Materials
aExpense Reference Implementation
Feedback & Issue Reporting
Creating Structured and Meaningful Logs with Semantic Logging
Enterprise Library consists of reusable software components that are designed to assist developers with common enterprise development challenges. It includes a collection of functional application blocks addressing specific cross-cutting concerns such as data access, logging, or validation; and wiring blocks, Unity and the Interception/Policy Injection Application Block, designed to help implement more loosely coupled, testable, and maintainable software systems.
Different applications have different requirements, and you will find that not every application block is useful in every application that you build. Before using an application block, you should have a good understanding of your application requirements and of the scenarios that the application block is designed to address.
Microsoft Enterprise Library 6 contains the following application blocks:
- Data Access Application Block. Developers can use this application block to incorporate standard database functionality in their applications, including both synchronous and asynchronous data access and returning data in a range of formats.
- Exception Handling Application Block. Developers and policy makers can use this application block to create a consistent strategy for processing exceptions that occur throughout the architectural layers of enterprise applications.
- Logging Application Block. Developers can use this application block to include logging functionality for a wide range of logging targets in their applications. This release adds asynchronous logging capabilities.
- Policy Injection Application Block. Powered by the Interception mechanism built into Unity, this application block can be used to implement interception policies to streamline the implementation of common features, such as logging, caching, exception handling, and validation, across a system.
- Semantic Logging Application Block. This application block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Microsoft Azure table storage, SQL Server databases, and flat files with several formats and rolling capabilities. Developers can extend the block by creating custom formatters and sinks. For those sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analyzing or processing the logged data. Events can be persisted in-process or collected and persisted out-of-process in a separate service.
- Transient Fault Handling Application Block. This application block makes on-premises or cloud applications more resilient to transient failures by providing intelligent retry logic mechanisms.
- Unity Application Block. Developers can use this application block as a lightweight and extensible dependency injection container with support for constructor, property, and method call injection, as well as instance and type interception. This release adds support for Windows Store apps as well as the registration by convention feature to ease the task of configuring Unity.
- Validation Application Block. Developers can use this application block to create validation rules for business objects that can be used across different layers of their applications.
Enterprise Library also includes a set of core functions for declarative configuration support.
Enterprise Library can be useful in a variety of situations:
- Enterprise Library provides sufficient functionality to support many common cross-cutting scenarios that enterprise-level applications must address.
- Enterprise Library can serve as the basis for a custom library. You can take advantage of the extensibility points incorporated in each application block and extend the application block by adding new providers. You can also modify the source code for the existing application blocks to incorporate new functionality, and even add new application blocks to Enterprise Library. You can either develop extensions for existing application blocks and new application blocks yourself, or you can use extensions and application blocks developed by others.
- Enterprise Library is designed so that its application blocks can function independently of each other. You need to add only the application blocks that your application will use.
- Enterprise Library includes the source code and the unit tests for all application blocks. This means you can explore the implementations, modify the application blocks to merge into your existing library, or you can use parts of the Enterprise Library source code in other application blocks or applications that you build.
- Enterprise Library includes documentation, a reference implementation, and source code. Enterprise Library embodies many design patterns, and demonstrates good architectural and coding techniques. You can use the library as a tool for learning architectural, design, and proven coding practices.
These reusable components and guidance are intended primarily for software developers and software architects. To get the most benefit from this guidance, you should have an understanding of the following technologies:
- Microsoft Visual C# or Microsoft Visual Basic .NET
- Microsoft .NET Framework
IT Professionals and system administrators will benefit from using Enterprise Library as it makes deployment and maintaining of systems easier. The new Semantic Logging Application Block would appeal to IT Professionals a lot as it aids developers in building a sound logging strategy, resulting in logs that are much easier to query and process when troubleshooting applications. IT Professionals can also use the configuration console to modify application blocks configuration with no programming required.
Contents of This Release
Microsoft Enterprise Library 6 contains the following:
- Binaries. The Enterprise Library includes precompiled, strong-named assemblies for all the source code.
- Source code. The Enterprise Library includes the source code for the application blocks and the configuration tools.
- Unit tests. The Enterprise Library includes the unit tests that were created while the application blocks were being developed.
- Documentation. A separate download for Enterprise Library includes documentation, which includes guidance about how to use the Enterprise Library and a class library reference.
- Hands-on Labs. The Enterprise Library Hands-on Labs help you learn about the Enterprise Library application blocks and practice how to leverage their capabilities in various application contexts. Step by step instructions and before and after source code are provided for each lab.
- Supported architectures: x86 and x64.
- Operating systems: Microsoft Windows 8, Microsoft Windows 7, Windows Server 2008 R2, Windows Server 2012.
- Supported .NET Frameworks: Microsoft .NET Framework 4.5, .NET for Windows Store Apps (previously known as Windows Runtime) for Unity and Transient Fault Handling Application Blocks.
For a rich development environment, the following are recommended:
- Microsoft Visual Studio 2012 (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:
- Stores to maintain log messages. If you are using the Message Queuing (also known as MSMQ) Trace Listener to store log messages, you need the Microsoft Message Queuing 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. The following are supported: SQL Server 2008 and higher, SQL Server LocalDB, Azure SQL Database.
- If you are using the Azure Sink to store log messages, you need access to a Azure storage account. You must also install the Azure SDK Version 1.8.
For the Transient Fault Handling Application Block, the following is required to install the NuGet package*:*
- NuGet 2.2. This is included in Visual Studio 2012 Update 2. Once the package is downloaded, you can copy the assemblies to a machine that does not have NuGet 2.2 and use the block there.
If these dependencies are not met, you may not be able to use certain Enterprise Library features.
Enterprise Library is intended for use by developers who build complex, enterprise-level applications. Enterprise Library is used when building applications that typically will be deployed widely and must interoperate with other applications and systems. In addition, they generally have strict security, reliability, and performance requirements. The goals of Enterprise Library are the following:
- Consistency. All Enterprise Library application blocks feature consistent design patterns and implementation approaches.
- Extensibility. All application blocks include defined extensibility points that allow developers to customize the behavior of the application blocks by adding their own code.
- Ease of use. Enterprise Library offers numerous usability improvements, including a configuration tool, powerful programmatic configuration support, intuitive interfaces, a simpler installation procedure that allows you to select only those application blocks you require, and clear documentation, samples, and hands-on labs.
- Integration. Enterprise Library application blocks are designed to work well together or individually.
This major release of Enterprise Library contains many compelling new features and updates that will make developers and IT professionals more productive. Two new application blocks are:
- Semantic Logging Application Block.
- Transient Fault Handling Application Block (this application block was previously a part of the Enterprise Library Integration Pack for Azure; in this release it has been generalized and updated to the latest technologies).
Other major new features include:
- New programmatic configuration that doesn’t require a container.
- AsynchronousTraceListenerWrapper for the Logging Application Block, which enables existing listeners to write messages asynchronously.
- JSON formatter for the Logging Application Block.
The new Unity Application Block includes many improvements:
- Registration by convention.
- Support for NetCore (Windows Store apps).
- Resolving objects of type Lazy<T>.
- The Unity assembly is now Security Transparent.
- Support for ASP.NET MVC and ASP.NET Web API.
Note, this release of Enterprise Library retired the following application blocks:
- Caching Application Block
- Cryptography Application Block
- Security Application Block
Our deprecation philosophy is outlined in this post. To help with migration from v5 to v6, refer to the Migration Guide.
The detailed list of all changes is included in the Release Notes.
For information about getting started with Enterprise Library, see the Enterprise Library documentation.
The Enterprise Library, like many patterns & practices deliverables, is associated with a community site: www.codeplex.com/entlib. On this community site, you can provide feedback and connect with other users to share ideas. You can post questions and get support using the Enterprise Library Discussion forum. You can also download additional content, such as extensions and training material. Community members can also help Microsoft plan and test future releases of the Enterprise Library and other application blocks. We also accept and encourage community contributions – see the guidelines.
Feedback and Support
Questions? Comments? Suggestions? To provide feedback about this release, or to get help with any problems, please visit the Enterprise Library Discussion forum and the Enterprise Library community site. The community site is the preferred feedback and support channel because it allows you to share your ideas, questions, and solutions with the entire community. Enterprise Library is a guidance offering, designed to be reused, customized, and extended. Code-based guidance is shipped "as is" and without warranties. Customers can obtain support through Microsoft Premier Support Services for a fee, but the code is considered user-written by Microsoft support staff.
Authors and Contributors
Microsoft Enterprise Library 6 was produced by the following individuals:
- Product/Program Management: Grigori Melnik (Microsoft Corporation)
- Architecture/Development: Julian Dominguez (Microsoft Corporation), Fernando Simonazzi and Edgardo Rossetto (Clarius Consulting), Hernan de Lahitte (Digit Factory)
- Testing: Mani Subramanian (Microsoft Corporation), Mariano Grande (Digit Factory), Rathi Velusamy, Lavanya Selvaraj, and Shebu Kollam Valappil (Infosys Technologies Ltd.)
- Performance and Security Testing: Carlos Farre (Microsoft Corporation), Naveen Pitipornvivat and Soranai Chantarayotha (Adecco)
- Documentation: Dominic Betts (Content Master Ltd), Julian Dominguez, Grigori Melnik, and Mani Subramanian (Microsoft Corporation), and Fernando Simonazzi (Clarius Consulting)
- Graphic design: Chris Burns
- Editing, pre- and post-production: RoAnn Corbisier, Nelly Delgado, Handan Selamoglu and Jane Sinyagina (Microsoft Corporation)
- Release management: Nelly Delgado and Grigori Melnik (Microsoft Corporation)
- Business administration support: Kerstin Scott (Microsoft Corporation)
Many thanks to the following Microsoft colleagues who were instrumental in architecting and developing the Semantic Logging Application Block: Vance Morrison, Dan Taylor, Mark Simms, Rafael Fernandez Moctezuma, and Michael Thomassy.
A special thanks to Microsoft colleagues who contributed many improvements of the Unity Application Block: Bob Brumfield (main contributor to porting Unity to .NET for Windows Store apps), Scott Densmore, Tyler Ohlsen, Chris Tavares, Andrew Oakley, and Hanz Zhang
Updates to the Transient Fault Handling Application Block were influenced by the following Microsoft colleagues: Mark Simms, Stephen Toub, and Valery Mizonov.
Enterprise Library 6 Advisory Board:
- 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, Rob Vettor (Microsoft Corporation)
Many thanks to the following people who reviewed our new guides and provided meaningful feedback:
- Garret Besser (Avanade)
- Thomas Mueller (CareSeed)
- Peter Ritchie
- Rob Jarratt
- Steven van Deursen (Cutting Edge Internet Technologies)
- Nicholas Blumhardt
- Chris Tavares, Alex Homer, and Tyler Ohlsen (Microsoft Corporation)
Additionally, we thank the following members of the community who commented on our initial vision and the product backlog: Damir Arh (Adacta), Jean-Luc Boucho (Infosys), Srđan Božović (MFC Mikrokomerc), Michael S. Collier (Aditi), Olivier Dahan (E-Naxos), Carlos dos Santos (CDS Informática), Christopher Maneu (Deezer), Paulo Morgado (C# MVP), Raffaele Rialdi (Vevy Europe), and Bruno Sonnino (Revolution Software)
- Microsoft patterns & practices Developer Center
- Microsoft Enterprise Library Home Page
- Unity Application Block