Microsoft Enterprise Library Introduction

Here I am learning about Microsoft Enterprise Library Introduction and noting down all the necessary points for this chapter. In Microsoft Enterprise Library there are several sections. However, Microsoft Enterprise Library Introduction is the first one that we need to understand to complete the whole part. Before I move into the other available chapters, I am going to start with Microsoft Enterprise Library Introduction and move forward eventually. For WIPRO Trend Nxt exam also you can refer this article as I would be including WIPRO Trend Nxt questions that come on the topic Microsoft Enterprise Library. So let’s get started with Microsoft Enterprise Library Introduction.

Microsoft Enterprise Library Introduction

Enterprise Library is made up of a series of application blocks. Each one of them aimed at managing specific crosscutting concerns. Crosscutting concerns are those annoying tasks that you need to accomplish in several places in your application. When we write the log for each and every job it becomes unfamiliar and Enterprise library makes it easy and generic. So that we can centralize and manage. A new term Application Blocks is used here. Application Blocks means reusable software components that have been designed to help the developer.

Microsoft Enterprise Library Introduction
Image is taken from Microsoft Library

What we can do with Microsoft Enterprise Library

In the picture above as you can see, there are eight blocks. However, there are only six blocks that do stuff. That is why we call them functional blocks. The other two blocks are wiring up blocks. There are also some shared pieces used in all these blocks. Here is an image to explain that.

Microsoft Enterprise Library Introduction
Image is taken from Microsoft Library

Standard Cross Cutting Scenario In Microsoft Enterprise Library

The list below describes the standard crosscutting scenarios. As per Microsoft:

  • Data Access. The Data Access Application Block simplifies many common data access tasks such as reading data for display, passing data through application layers, and submitting changed data back to the database system. It includes support for both stored procedures and in-line SQL, can expose the data as a sequence of objects for client-side querying, and provides access to the most frequently used features of ADO.NET in simple-to-use classes.
  • Exception Handling. The Exception Handling Application Block lets you quickly and easily design and implement a consistent strategy for managing exceptions that occur in various architectural layers of your application. It can log exception information, hide sensitive information by replacing the original exception with another exception, and maintain contextual information for an exception by wrapping the original exception inside another exception.
  • Transient Fault Handling. The Transient Fault Handling Application Block makes your application more robust by providing the logic for handling transient faults. It does this in two ways. First, the block includes logic to identify transient errors for some common cloud-based services in the form of detection strategies. Second, the application block enables you to define your retry strategies so that you can follow a consistent approach to handling transient faults in your applications. The block also helps you to perform retries if you are dealing with asynchronous, task-based code.

More Standard Cross Cutting Scenarios In Enterprise Library

  • Logging. The Logging Application Block simplifies the implementation of standard logging functions such as writing information to the Windows Event Log, an e-mail message, a database, Windows Message Queuing, a text file, or a custom location.
  • Semantic Logging. The Semantic Logging Application Block enables you to use the Event Souce class to write strongly typed log messages from your application. Enterprise Library allows you to write log messages with a consistent structure and format and to collect and process log messages out-of-process.
  • Validation. The Validation Application Block provides a range of features for implementing formal and easy-to-maintain validation mechanisms using attributes and rule sets and integrating with most types of application interface technologies.

If you have used previous versions of Enterprise Library and are wondering what happened to the Caching Application Block, Security Application Block and Cryptography Application Block as well as some other functionality, the answer is that these have been deprecated. Many scenarios supported by these blocks are now better supported by the .NET platform. Microsoft’s deprecation philosophy is outlined in this post.

Why Should We Use Enterprise Library

In this Microsoft Enterprise Library Introduction article, I am also going to discuss why do we need to use it. Enterprise library regularly provides the comprehensive set of features that help manage developers the cross-cutting concerns. Instead of writing own logging option we can leverage for that on Enterprise Library. Finally, it is free. When it is free to use why then to spend time creating our logging option. We can use this free choice.

Enterprise library also is like a candy shop. You can choose what you want to use and then use it. When we add the reference, then the required block configuration will be added automatically.

How to Add Enterprise Library

There is no Enterprise Library installation; you insert the blocks you need to any Visual Studio project by using the NuGet, package manager. You can find all the Enterprise Library blocks in the Manage NuGet Packages dialog in Visual Studio by searching online for Enterprise Library. You can also use the Package Manager Console in Visual Studio if you prefer to work on the command line.

Assemblies And References In Enterprise Library

It’s not uncommon, when people first look at Enterprise Library, to see a look of mild alarm spread across their faces. Yes, there are quite a few assemblies, but remember:

  • You only need to use those directly connected with your scenario.
  • Several are required for only very special situations.
  • The runtime assemblies you will use in your applications are mostly less than 100 KB in size, and the largest of all is only around 500 KB.
  • In most applications, the total size of all the assemblies you will use will be between 1 and 2 MB.
  • NuGet will make sure that you have all the required assemblies for the blocks that you are using.

GAC or Bin, Signed or Unsigned? All of the assemblies are provided as precompiled signed versions that NuGet places in a folder within your project. This helps to ensure that your project references the correct version of the assemblies you are using. However, you can install the assemblies into the global assembly cache (GAC) if you wish.

Importing Namespaces

After you reference the appropriate assemblies in your projects, you will probably want to add using statements to your project files to simplify your code and avoid specifying types using the full namespace names.

You will also need to import the namespaces for the particular application blocks you are using. Most of the Enterprise Library assemblies contain several namespaces to organize the contents. For example, the Semantic Logging Application Block includes the following namespaces.

  • Microsoft.Practices.EnterpriseLibrary.SemanticLogging
  • Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database
  • Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw
  • Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.WindowsService
  • Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure

Configuring Enterprise Library

Enterprise Library offers users several options for configuring the various blocks. Typically, you use an extremely flexible programmatic approach to configuring the blocks: this is the approach used in the examples in this guide. If you have used a previous release of Enterprise Library, you will have used either a declarative approach based on XML configuration files and the Configuration Tool, or the fluent configuration API. For more information about these legacy approaches, you should read the reference documentation and the Developer’s Guide for Enterprise Library 5.0.

More Information

All links in this book are accessible from the book’s online bibliography on MSDN at http://aka.ms/el6biblio.

If you want to know more about how you can use Unity and the Policy Injection Application Block, check out the Dependency Injection with Unity guide. This guide is also available on MSDN: Developer’s Guide to Dependency Injection Using Unity.

For more information about the topics covered in this chapter, see the Enterprise Library Reference Documentation.

For more information about these legacy approaches, you should read the reference documentation and the Developer’s Guide for Enterprise Library 5.0.

Unity 3 now supports the registration by convention to make it easier to do so. See the Dependency Injection with Unity guide for more info.

General Links:

I hope this Microsoft Enterprise Library Introduction helps you understand a little bit about Microsoft Enterprise Library Introduction. Let me know what you think about Microsoft Enterprise Library Introduction in the comments below. Also include if you have any more information.

I am a 25-year-old dude from a small village Narasinghpur in Cuttack, Odisha, INDIA. I am a graduate in M.Tech from BITS Pilani. I Started blogging back in June 2014 and you can check out my other blogs at www.prabhudatta.com.

2 Replies to “Microsoft Enterprise Library Introduction”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.