In April-2013, Microsoft has released Enterprise Library version 6.0 though it couldn’t got much notice as Entity Framework is leading in the data access technology. Entity Framework as a full ORM getting more popular day by day but Enterprise Library has its own class and usage scope.
Practical implementation of one of Enterprise Library block i.e. Data Access Application Block will be separately cover in another post. In fact, our discussion on Ent Lib, comprises 3 posts as-
1. Microsoft Enterprise Library 6 - new release (current post)
2. Data Access Application Block – Enterprise Library
3. Database provider factory not set for the static DatabaseFactory
Enterprise Library is more robust framework or class library written with performance and resource management best practices. Instead of reinvesting the wheel for data access framework, or other, you can easily plug-in this library into your application. It has blocks for Windows Azure or cloud specific also. Its binaries version that is pre-compiled and strongly typed can be downloaded for direct use. If you are willing to extend or customize it on the top of Enterprise Library source code then download its SourceCode bundle which is available under Microsoft Public License i.e. royalty free.
Enterprise Library is basically a collection of application blocks. These application blocs are for helping developers by providing reusable components (for example, Data Application Block deals for common data access jobs). These blocks are easy to plug-in into projects. Enterprise Library comes with an easy configuration tool that makes your life easier to plug-in required application block into your application. Though most of developers plug-in these application blocks programmatically as this approach is also easy.
Microsoft always comes with new technology to provide more help and robust services with easy access.
One can see following benefits in using it -
√ Ease of use
√ Easily Extensible (application blocs come with source code and Microsoft allows you to extend without royalty)
√ Well documented
√ Wide range of helping resource availability
√ Integration of blocks ( free to use any application block independently as well in integrated)
√ Free from Microsoft (Microsoft Public License – royalty free)
√ Well written with good practices
Since, the newer version of Enterprise Library is targeting new version of .net framework 4.5 so it has deprecated many application blocks as those functionalities are now well handled by .net framework itself (for ex. Async). This new library is well written for both in-premises as well cloud applications. The most important thing with the new version is that it has cleaned much dependency between application blocks compare to earlier versions. This library provides many high configurable features to manage the repetitive tasks such as data accessing, logging, validation, caching, exception management etc.
A look at MS Enterprise Library version 6.0
It contains following application blocks-
1. Data Access Application Block (Provide easy database access functionality in both synchronous and asynchronous data access and returning data in various formats.)
2. Exception Handling Application Block
3. Logging Application Block. Version 6.0 has asynchronous logging capabilities.
4. Policy Injection Application Block
5. Semantic Logging Application Block
6. Transient Fault Handling Application Block
7. Unity Application Block
8. Validation Application Block
It has added two new blocks –
1. Semantic Logging Application Block and
2. Transient Fault Handling Application Block
It has improved much more, below are only related with Logging and configuration-
√ Logging Application Block enhancements
o JSON formatter
o AsynchronousTraceListenerWrapper ( makes you to write messages asynchronously)
√ New programmatic configuration that don’t require a container
It has deprecated some blocks-
As I mentioned above, since this new enterprise library is targeting more powered new .net framework version, below application blocks has been retired and no more with Enterprise Library v6.0
1. Caching Application Block
2. Cryptography Application Block
3. Security Application Block
How to use?
Download the latest Enterprise Library from Patterns & Practices – Enterprise Library at CodePlex website.
It is very easy to use, just need to plug-in the required application blocks into projects by referencing the assemblies and configuring the settings. NuGet makes it very easy to get started as it does all the required things in one easy step and make ready to use. Also, it we can configure application blocs using tool that comes with Enterprise Library.
Each application block contains dlls(assemblies) so for using a particular block, you need to reference the related dlls only. There are mainly 3 types of assemblies (dlls) – Common assembly, main application block assemblies and Unity assemblies. Common assemblies are required to depended application blocks and Unity assemblies are only required when specific unity references are being done in project.
After referencing and configuring, we can use the code of application block into our application. To give easiness, we can import root namespace with help of “using” in C#.Ex-
How to use "DAAB" block, see: "Data Access Application Block – Enterprise Library"