Export (0) Print
Expand All

About This Release of Enterprise Library

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

This release of Enterprise Library includes a new application block (see The Unity Application Block). Unity is a lightweight, extensible dependency injection container with support for constructor, property, and method call injection. You can use the Unity Application Block as a stand-alone dependency injection mechanism without requiring installation of Enterprise Library. However, this release of Enterprise Library incorporates integration with Unity that provides new opportunities for generating instances of Enterprise Library objects.

There are also additions in functionality to several of the existing application blocks. The following sections discuss these and other changes in the current release. In addition, this release has been adapted to work with Microsoft Visual Studio 2008, Windows Management Instrumentation (WMI) version 2.0, and the Microsoft .NET Framework 3.5.

This topic contains the following information about this release of Enterprise Library:

This release of Enterprise Library contains the following:

  • Binaries. The Enterprise Library includes pre-compiled, strong-named assemblies for all the source code. For more information, see Using the Signed Binary Assemblies.
  • Source code. The Enterprise Library includes the source code for the application blocks, the configuration tools, the unit tests, and the QuickStarts.
  • Unit tests. The Enterprise Library includes the unit tests that were created while the application blocks were being developed. For more information, see Unit Tests.
  • QuickStarts. Enterprise Library QuickStarts are brief, easy-to-understand illustrations of key application block features. Each application block includes one or more QuickStart.
  • Documentation. Enterprise Library includes documentation that can be viewed with the Visual Studio Help system. The documentation includes guidance about how to use the Enterprise Library and a class library reference.

The following two features have been removed from this release of Enterprise Library and are now available separately:

  • The Application Block Software Factory
  • The Strong-Naming Guidance Package

Both of these features are suitable for use in many situations outside of Enterprise Library; therefore, it is appropriate to be able to download and install them separately from Enterprise Library. For more details, and to download these features, see the patterns & practices community site on CodePlex.

For a complete list of the application blocks, configuration and other tools, and the core features of Enterprise Library, see Contents of Enterprise Library in the Getting Started section of this guidance.

In this release of Enterprise Library, you can use the Unity Application Block (Unity) to generate instances of Enterprise Library objects, and inject Enterprise Library object instances into other objects. Enterprise Library contains a set of classes that allow you to obtain instances of objects such as a SqlDatabase or a CacheManager, defined in the Enterprise Library configuration, from the Unity container. In addition, new “injection-friendly” façades for some of the Enterprise Library objects replace the old static façades, which cannot be used with injection.

These features use the dependency injection capabilities of Unity, and can simplify your code considerably. For more information about the integration of Unity and Enterprise Library, see Creating Objects Using the Unity Application Block.

The following changes to the Enterprise Library affect all the application blocks:

  • Enterprise Library 4.0 takes advantage of the improved features in the .NET WMI 2.0 API to provide update capability for configuration exposed through the manageable configuration source. Objects defined in the Enterprise Library configuration, such as databases, trace listeners, and cache backing stores, are exposed through WMI as a set of classes that you can query and update. If you have the relevant Windows permission to update WMI values, any changes you make to the properties of these classes are reflected back through the manageable configuration source and update the configuration information exposed to your application. Changes do not affect the original configuration file contents and may be overridden by Group Policy.
  • In version 4.0, Enterprise Library has the Allow Partially-Trusted Caller attribute (APTCA) on all assemblies. This means that you can call the methods of Enterprise Library and the application blocks from an application running in a partial trust environment. You can do this with the signed assemblies provided with Enterprise Library. There is no longer any requirement, as there was in version 3.x, to recompile the source code and the source code for ObjectBuilder and then either use the unsigned binaries or strong name them yourself.

The following changes have been made to this version of the Caching Application Block:

  • The application block has been refactored to allow developers to replace the CacheManager class with their own implementation if required. This does not affect the API of the application block or the existing CacheManager. Developers can install and configure a custom cache manager implementation using the configuration tools provided that the new class implements the ICacheManager interface and carries the following attribute.
  • [ConfigurationElementType(typeof(CustomCacheManagerData))]
    
    
  • The application block implements several new performance counters that you can use to monitor performance and operations. The new counters are Total Cache Hits, Total Cache Misses, Total Cache Expiries, Total Cache Scavenged Items, and Total Updated Entries.

The following changes have been made to this version of the Cryptography Application Block:

  • The application block implements several new performance counters that you can use to monitor performance and operations. The new counters are Total Hash Comparisons, Total Hash Mismatches, Total Hash Operations, Total Symmetric Decryptions, and Total Symmetric Encryptions.

The following changes have been made to this version of the Data Access Application Block:

  • The application block implements several new performance counters that you can use to monitor performance and operations. The new counters are Total Commands Executed, Total Commands Failed, Total Connections Opened, and Total Connections Failed.

The following changes have been made to this version of the Exception Handling Application Block:

  • The Logging Handler has a new Boolean property named UseDefaultLogger. When set to True, the handler writes every log event and exception to the same file. When set to False (the default) it writes log event and exception information to separate files named with a GUID.
  • The application block implements two new performance counters that you can use to monitor performance and operations. The new counters are Total Exceptions Handlers Executed and Total Exceptions Handled.

The following changes have been made to this version of the Logging Application Block:

  • The application block now allows you to specify a value for the Filter property of each of the trace listeners. This property applies a filter that selects the level of message that it will detect. The valid values are All, Off, Critical, Error, Warning, Information, Verbose, and Activity Tracing. The setting effectively means "the specified level and everything more important." For example, the Warning setting will detect warnings, errors, and critical events. The default setting is All, which means that the behavior of the listener is the same as in earlier versions of Enterprise Library if a value is not specified in the configuration.
  • The application block now allows you to specify that the RollingFlatFileTraceListener will start a new file at midnight every day. To use this behavior, set the value of the RollInterval property of the RollingFlatFileTraceListener to Midnight.
  • The application block contains performance improvements, including the following:
    • Delayed gathering of context information until actually requested (except in distributed scenarios where context information is gathered even if it is not used).
    • Automatic flushing is now configurable. However, the default is to flush always, which means that the behavior of the listener is the same as in earlier versions of Enterprise Library if a value is not specified in the configuration. To disable automatic flushing, set the AutoFlush property of the log source to True. It is then your responsibility to ensure that all entries are flushed to the target, especially if an exception or failure occurs in the application. Otherwise, you will lose any cached logging information not yet written to the target.
  • Log file names now support the use of environment variables. You can include environment variables such as %WINDIR%, %TEMP%, and %USERPROFILE% in the Filename property of the Flat File Trace Listener, Rolling Flat File Trace Listener, and XML Trace Listener.
  • The application block implements several new performance counters that you can use to monitor performance and operations. The new counters are Total Logging Events Raised, Total Trace Listener Entries Written, and Total Trace Operations Started.

The following changes have been made to this version of the Policy Injection Application Block:

  • When you use the Validation Call Handler, you can specify the name of a rule set when you use an Object Validator to validate individual parameters of a method, as shown in the following code.
  • [ValidationCallHandler]
    public void SomeMethod(
                [RegexValidator("...")] String x,
                [ObjectValidator("RulesetName")] String y) 
    { 
      ... 
    }
    
    
  • All call handlers in the application block now expose an integer property named Order that you can use to specify the order of the handlers within the policy handler chain. The default value is zero, which means that there is no explicit order specified for that handler in relation to other handlers in the same handler chain. To specify an explicit order, set the Order property for each handler starting from 1. If you specify the same value for the Order property of two handlers in the same policy, the application block will add them to the policy handler chain in the order that it creates them.

The following change has been made to this version of the Security Application Block:

  • The application block implements several new performance counters that you can use to monitor performance and operations. The new counters are Total Authorization Requests, Total Authorization Requests Denied, and Total Security Cache Reads.

The following changes have been made to this version of the Validation Application Block:

  • Use of multiple rule sets to validate an object. The Validate method of the Validation façade now accepts multiple rule set names; this means you can apply more than one set of rules to an object. For example, if you have two rule sets named RuleSetA and RuleSetB defined in the configuration of the application, you can apply the rules from both using the following code.
  • ValidationResults results = customerValidator.Validate(myCustomer, "RuleSetA", "RuleSetB");
    
    
  • The Object Validator accepts as a parameter the name of a rule set (usually defined in configuration of the application block). This is useful where you apply validation to individual parameters of a method, as shown in the following code.
  • public void SomeMethod(
                [RegexValidator("...")] String x,
                [ObjectValidator("RulesetName")] String y) 
    { 
      ... 
    }
    
    

Show:
© 2014 Microsoft