Enterprise Library Introduction

Source: Internet
Author: User

Enterprise Library is a collection of application blocks used by developers who create complex Enterprise-level applications. These applications are usually widely deployed and dependent on other applications and systems. In addition, they usually have strict security, reliability, and performance requirements.
 

 
The goal of Enterprise Library is as follows:
 

Consistency. All application blocks have consistent design patterns and implementation methods.
 

Scalability. All application blocks define extensions that allow developers to add their own code to customize the behavior of application blocks.
 

Easy to use. The Enterprise Library provides many Usability Improvements, including graphical configuration tools, simple installation processes, and clear and complete documentation and examples.
 
Integration. The Enterprise Library is designed to work well together and tested to ensure that they can be done. Of course, you can also use the application block separately.
 

Advantages
 

The Application Block helps developers solve common problems from a project to the next project. They are designed to encapsulate Microsoft-recommended best practices for. NET applications. It can also be quickly and easily added to. NET applications. For example, data access application blocks provide access to the most commonly used ADO. NET features and expose them through easy-to-use classes. In some cases, the application block is not directly supported by the basic class library.
 

The main changes of some application modules are described in the following sections, including the data access module, log module, and security module.

Encryption module.

This module now stores each key in a separate file. You can use the data protection API (DPAPI) to encrypt the key file.

Data access module

The data access module of the Enterprise Library includes the following changes:

· The data access module makes it easy to configure the connection string, but it is easier to use other methods in the 2.0 version. For example, you can dynamically create a connection string based on the business logic and use this connection string to create a Database class.

· The data access module uses the new ADO. NET connectionStrings configuration section, which allows the connection string to be shared in the application module and Other. NET classes that use this section ..

· Now, by using the GenericDatabase class, you can use any ADO. NET2.0 to host the supplier's data access module, even if you do not specifically design a database Driver Class for that type of database. You can still create a database driver class between different database instances to provide enhanced functions (such as parameter discovery) and transparency. This application module contains database driver classes for SQL Server and Oracle, you can use the GenericDatabase class to access the OLE-DB and ODBC database.

Log Module.

The Log Module contains the following changes:

· To use the System. Diagnostics namespace, the class log module has been redesigned, such as the TraceListener class and CorrelationManager class. It is worth noting that the log receiver of version 1.0 has been replaced with a listener .. The log module contains a series of tracking listeners. You can use an existing. NET tracking listener or a third-party tracking listener ..

· The log class has been replaced by a LogEntry class instance. In the enterprise class library of version 1.0, each LonEntry instance can have only one category. The new version supports a single logentry instance in a variety of categories. Because the categories are used to filter and route the LogEntry example diagrams to different tracing listeners, can identify multiple categories of important application modules that improve the scalability ·.

· The log module uses LogFilter instances to prevent certain events from being recorded according to the specified rules configured in the configuration file, such as the minimum priority or special category rules .. These filters are extensible and pluggable, which means developers can write their filters. In addition, filters can now be queried from application APIs so that developers can reduce the cost of data collection.

· After removing the concept of distribution strategies, the structure of the application module has become easy to understand. The tracing listener now supports the centralized message queue and asynchronous log functions provided by distribution strategies.

Security Module

Many security module functions provided by version 1.0 have been deleted because.. NET Framework 2.0 already provides equal functions ·. in particular, factory models, interface programs, and providers provided for identity authentication, role judgment, and personalized configuration have been deleted, and the same functions have been.. NET Framework. web. security. membership and System. web. the Profile namespace is provided .. The relevant documentation provides a migration wizard for users who want to use these new classes. The new security module still contains factory modes, interface programs, and providers for cache authorization and security.

Application Module of Enterprise Library:

The application module helps solve the same problems that developers often encounter in different projects. They are used to encapsulate the. NET application-based class libraries recommended by Microsoft. In addition, they can be quickly and easily added to. NET-based applications. For example, the data access module provides the ADO. NET 2.0 feature that is frequently used to improve development efficiency. It also supports situations that are not directly supported by the class library.

Different applications have different requirements, and you won't find every application module useful in every application you build. Before using the application module, you should have a deep understanding of your application requirements and application modules as your experience grows, you can change the configuration of the application module without modifying its code, re-compiling, or re-deploying it. Have a good understanding.

The Enterprise Library of Version 2.0 contains the following general application modules:

· Cache module · developers can use this module to implement a local cache in their applications.

· Encryption module · developers can use this module to implement hash and symmetric passwords in their applications.

· Data Access Module · developers can use this module to implement standard database functions in their applications.

· Exception Handling Module · using this module, developers and decision makers can create a consistent policy for exceptions generated throughout the application.

· Log module · developers can use this module to include standard log functions in their applications.

· Security Module · developers can use this module to implement authorization and secure cache functions in their applications.

Enterprise libraries also contain a set of core functions, including configuration, probe, and object creation services. These functions are used in all other application modules.

Configuration tools for Enterprise Library:

The application module is designed for multiple enterprise application development scenarios. This design method allows you to easily configure an application module to meet your needs .. You can easily configure an application by using the Enterprise Library Configuration window, defining the configuration section for the main functions of an application module and each provider type.

Configuring an application module in the configuration section in a special case has two advantages:

· Different people can configure an application module at different times of the application lifecycle. For example, a developer can configure a provider during application development to access a special database, while another system administrator can encrypt the database connection string.

· You can change the configurations of application modules for more and more complex situations. For example, you can use the default settings and providers to initialize the configuration of an application. As your understanding of the situation grows as your experience grows, you can change the configuration of the application module without modifying its code, re-compiling, or re-deploying it.

The Enterprise Library contains a visual Configuration tool called the Enterprise Library configuration console. You can use the configuration console to modify and verify the application module configurations without manually editing the XML configuration file. For example, two cache modules are configured to determine whether to use the backup storage and cache data items. The configuration console displays these configurations and provides changeable default values. The cache can be suspended for software engineering and data items. You can change the configurations and supply default values of the configuration control monitor. Since graphical tools provide visual configuration, it means you can easily configure application modules.

Every application module can be expanded, so that developers can implement (symbolic, these are called providers) their own special functions. For example, you can customize your backup storage functions for the cache module. These custom providers can be used by developers. The configuration console allows you to select a custom backup storage and write this information to the corresponding XML configuration file. This means that the application will use the custom backup storage without changing any code or re-compiling.

Figure 1 shows the user interface of the configuration console.

 

Figure 1 configuration console user interface

Compile and run the configuration Console

When you install the Enterprise Library, the configuration console source code is included in the source code of the application module. You must compile the configuration console. Execute the BuildLibrary. bat batch file to compile the configuration console.

The configuration Console requires that the set of application libraries and the configuration console executable program (entlibconfig.exe) or the Global Assembly are in the same directory. It requires the runtime assembly and the design-time assembly. Each application encapsulates design-time assemblies separated by runtime, which are not required for running an application that uses an enterprise module. However, when you change the configuration of an application module, the configuration console needs to use these sets, including suffix. configuration. design. dll. Use CopyAssemblies. bat to copy the required assembly to the bin directory.

When the copyassemblies.exe batch file is executed, it copies all the required runtime and design-time assembly to the bin directory, for more information about runtime Configuration components and Design-time Configuration components, see Design-time Configuration.

Note: <0
 
When the configuration console opens a configuration file, it will try to load all the assemblies that reference the file. If your configuration file contains another custom provider, make sure that the custom assembly can be referenced by the configuration file console. If your configuration file contains another custom provider, you must ensure that the custom assembly can be referenced by the configuration file console. Device identifier of the circular object. You can copy the assembly to the same directory as the configuration console can execute or install it to the Global Assembly Cache. You can also use the DEVPATH environment variable to load the custom assembly on the configuration file console.
 

To use the configuration file console, click Start to point to all programs, Microsoft patterns & practices, Enterprise Library-January 2006, and then click Enterprise Library configuration.

Portable Information:

Enterprise Library version 2.0 is a version designed to use the new features of. NET Framework 2.0. Although this is a new version, it also follows the design structure and principles of version 1.0. Many changes are made within the Assembly-they reflect the advantages of implementing. NET Framework 2.0 and do not require you to modify existing applications. However, if you try to use a new version in the original application, some problems may occur. For example, the configuration data is processed in different ways in version 2.0. Therefore, you must migrate an existing application to use the 2.0 enterprise class library .. However, note that porting is optional. The Enterprise Library application module supports side-by-side operations. Therefore, you can choose to gradually migrate your application, one assembly at a time; migrate only a portion of the application; or do not change your application and use the new features you have added.

Run Side-by-Side

The Enterprise Library of Version 2.0 can be installed in the form of side-by-side, in applications that use the 2.0 enterprise class library, you can call applications that use the 1.0 enterprise class library .. In addition, you can choose to port an existing application, one assembly at a time.

If you decide to run in the form of side-by-side, you must reference different enterprise class libraries in different directories. Enterprise class libraries of different versions cannot exist in any given directory. For example, a data access module of Version 1.1 and a cache module of Version 2.0 cannot exist in the same directory.

The project uses the AssemblyInfo. cs file to create an assembly with different version information, which allows you to use strong names and different versions in a global assembly.

Partial Transplantation

Each assembly of an application can reference only one version of the enterprise class library. However, if an application has multiple assemblies, You can reference multiple versions of the enterprise class library. For example, if one of your applications has two sets, both of them use the 1.1 enterprise class library, one of which can be migrated to. NET Framework 2.0 while the other remains unchanged. This means that you can gradually migrate your application, one assembly at a time.

Note:
 
The Enterprise Library configuration console has strict requirements on its version, and the DLL must match its version under its directory. T. Therefore, when you configure an enterprise-class library of different versions, you must use the configuration console of different versions.
 

When some porting is supported, its implementation becomes complicated to some extent, so it is not recommended ..

Transplant application code

The redesigned 2.0 Enterprise Library is different from the 1.0 Enterprise Library in many ways. 2.0 is used. NET Framework 2.0, so some Enterprise Library functions have been simplified or removed .. However, API changes are described in the documentation of relevant modules. For more information about API changes and code porting requirements, see descriptions of each module .. Is in the Assembly. To a large extent, public APIs are the same as those for Version 1.0.

API changes are described in the documentation of relevant modules. For more information about API changes and code porting requirements, see descriptions of each module.

Port Configuration Information

Compared with the Enterprise Library of version 1.0, version 2.0 stores configuration information in different places. The default storage location is the application configuration file .. The Enterprise Library of Version 2.0 stores different application modules in different configuration files. For example, the configuration information of the cache module is stored in the CachingConfiguration. config file.

The configuration mode of each application module is similar, but not the same as that of version 2.0. You need to migrate your configuration data to the new mode and the new storage unit (application configuration file ). The simplest way is to use the enterprise-class Database Configuration console to re-create application configurations. Optional. You can manually port configuration data. For more information, see the XML configuration mode of the application module documentation.

Asp.net collection
This article from net.21shipin.com ASP. NET tutorial network source: http://net.21shipin.com/ajc/70.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.