Share via


The Enterprise Library Core

Many tasks that the Enterprise Library application blocks perform are common across more than one application block and are also useful in application code outside of Enterprise Library. Examples are routines that serialize data or access configuration information. To promote usability, these routines reside in a common assembly named the Enterprise Library Core.

In addition, all the application blocks are designed to have a limited number of dependencies so that they can be used individually as well as with other application blocks. All application blocks except Unity depend on the Enterprise Library Core, which is a logical grouping made up of the following subsystems:

  • The Common assembly
  • Instrumentation for the application blocks
  • Configuration helper classes and design-time configuration components

For information about the dependencies between application blocks and the Enterprise Library Core, see Dependencies in Enterprise Library.

The Common Assembly

The Enterprise Library includes an assembly named Common that contains useful elements that are shared among multiple application blocks. Any application that uses an Enterprise Library application block (with the exception of Unity) must reference this assembly. By supplying a set of commonly used functions to all the application blocks, the Common assembly reduces the dependency of one application block on another.

The following are some criteria used to factor elements into the Common assembly:

  • Elements could not depend on other application blocks. However, they could depend on other elements that are already in the Common assembly.
  • Elements could not depend on any persistent state.
  • Elements could not depend on any third-party technology.
  • Elements could not imply a particular application model. They could be used equally well in any application model. For example, the elements should function as well in a smart client as in a Web service.

Instrumentation

Most of the application blocks contain instrumentation. The types of instrumentation are the following:

  • Performance counters
  • Event log events

The instrumentation classes are a part of the Enterprise Library Core and are located in the Common assembly. You can follow similar instrumentation patterns in your own code.

By default, instrumentation is disabled, but you can use the Enterprise Library configuration tools to enable each type of instrumentation. If you have administrative rights, you can use the Installutil.exe program to install the instrumentation.

Most other dependencies are encapsulated in individual providers. For example, the Exception Handling Application Block can use the Logging Application Block to publish exception information, but this is not a requirement. You can choose to publish exception information to other sources, such as the event log, or you can extend the Exception Handling Application Block by supplying your own logging provider.

Configuration Helper Classes and Design-time Components

Configuration uses the System.Configuration namespace, which makes it easier to use application blocks either with configuration files or without them. Factories (and Unity) create application block objects from the data contained in configuration files. It is possible to use alternatives to XML configuration files as configuration sources. For example, you can use a SQL ServerĀ® database. You can also create objects without using configuration files; you can do this by using constructors with primitive data types.

To support extensibility in Enterprise Library, configuration includes helper classes in addition to those classes found in the System.Configuration namespace. These helper classes support polymorphic collections, generic collections, and configuration sources. These enhancements require configuration to be based on the Dependency Injection pattern instead of the Provider pattern, as is the case with the System.Configuration namespace.

The configuration tools allow you to change an application block's configuration without directly editing the XML configuration files. You can use the design-time components that the configuration tools use with applications and application blocks that you create to give your users a similar experience to the Enterprise Library Configuration Console and Configuration Editor.