Copyright (c) 2007 Dorian Deng. Signature Sharing is not commercially available.
Reprinted please indicate the source: http://blog.csdn.net/doriandeng/archive/2007/09/17/1787635.aspx
ApplicationProgramThe block design is used in various enterprise application development scenarios. This design method allows you to easily adapt to an application block to meet your actual needs. Use configuration settings to complete it, which is very easy to change with the configuration tool. You can define configuration settings for the core functions of the Application Block and each provider type.
Using configuration settings to adapt application blocks to specific situations has two advantages:
Different people can configure the features of application blocks in different time periods during the application lifecycle. For example, a developer can configure a provider to access a specific database during application development, and the system administrator can decide to encrypt the database connection string during development.
You can add Application Block configurations for increasing complexity. For example, you can use the default settings and the provider to initialize the configuration of an Application Block. With your in-depth understanding of the scenario and advances in skills, you can modify the application block configuration without modifying it.Code, Re-compile or re-deploy it.
The Enterprise Library contains graphical configuration tools that allow you to create and modify configuration files. The configuration editor is integrated with Visual Studio and has an independent version (Enterprise Library configuration console ). These two configuration tools have the same functions. With these tools, you can modify and verify the application block settings without manually modifying the xml configuration files they save. The Configuration tool displays the modifiable settings and supported default values.
Each application block contains extensions that developers can use to include their own implementations (for example, providers. For example, you can add backend storage to the cache application block. These custom providers can be exchanged with the providers provided by the Application Block. The configuration console allows you to select Custom background storage and save this information to the appropriate xml configuration file. This means that applications use custom storage without modifying any code or re-compiling.
Figure 1.1. console user interface configuration example
Use the configuration Editor
The configuration editor is integrated with Visual Studio. It uses standard Visual Studio standard operations to create, open, and save files. You can double-click the solution browser to open a configuration file. You can also clickFile→Open→FileAnd navigate to the file to be opened.
If the file is under source code control, common rules will be applied. You have to check out the modification before saving it to a file.
The configuration editor uses the Standard Visual Studio window and list to display information:
The main Visual Studio window displays the configuration levels.
To display and modify the attributes of a node, You must select a node in the main window.
All configuration verification errors are displayed in the Standard Visual Studio Error List.
Use the configuration Console
To use the configuration console, clickStart, PointingProgram, PointingMicrosoft patterns & Practices, PointingEnterprise Library 3.1And then clickEnterprise libraryconfiguration.
Build configuration Console
The Enterprise Library contains an executable file of the configuration console placed in the correct directory. In any case, if you customize the console source code, you may need to re-compile the source code. This can be usedBuildlibrary
Batch file to complete.
The configuration Console requires that the application block assembly be placed in the same directory as the configuration console executable file or in the Global Assembly Cache. It requires that the runtime assembly and the design-time Assembly coexist. These assemblies do not include the assemblies used to run applications that use application blocks. In any case, the configuration console uses them when modifying Application Block configurations. The required assembly has a suffix.. Configuration. Design. dll. AvailableCopyassemblies
Copy the Necessary assemblyBin
Directory.
When runningCopyassemblies
When a batch file is processed, it copies all the necessary assembly for runtime and designBin
Directory. For more information about the relationship between runtime configuration components and design-time configuration components, see design-time configuration.
Note:
when the configuration console opens a configuration file for an application, it tries to load the assembly of all providers referenced in the file. If an application configuration contains a custom provider, you must build an assembly that can be used to configure the provider for the console. You can copy an assembly to the configuration console executable file directory or install it in the global cache. You can also use the devpath
environment variable to allow the configuration console to locate the provider's assembly.