Main content:
1. Overview
2. Using facility
3. Principle Analysis
A Overview
Enterpriselibrary Configuration facility is like a bridge between a container and a data class, so that we can easily read and manipulate the configuration file. People familiar with the Enterprise Library know that there is a configuration Application block in the Enterprise Library that allows us to easily read and write configuration information from a variety of stores. By Enterpriselibrary Configuration Facility We can register a data class like a normal component, which is mapped to the Enterprise Library's configuration file using Configurationkey. Let's take a look at the facility information:
Facility Information |
Uses Proxy |
No |
Requires Configuration |
Yes |
Uses Attributes |
No |
Version |
Beta 2 |
Two Using facility
1. Configuration files, where you use the configuration file registration component in the application configuration file, the only thing to note here is Configurationkey, which cannot be written incorrectly:
<?xml version= "1.0" encoding= "Utf-8"
<configuration>
<configsections>
<sec tion name= "enterpriselibrary.configurationsettings" type= "System.Configuration.IgnoreSectionHandler, System, version=1.0.5000.0, Culture=neutral, publickeytoken=b77a5c561934e089 "/>
<section name=" Castle "Type=" Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.windsor "/>
</configSections>
<enterpriselibrary.configurationsettings xmlns:xsd= "" xmlns:xsi= ""
defaultsection= "ApplicationName=" A Pplication "xmlns=" "
<configurationsections>
<configurationsection name=" editorsettings "en Crypt= "false"
<storageprovider xsi:type= "Xmlfilestorageproviderdata" name= "XML File Storage Provider" p Ath= ". /.. /editorsettings.config "/>
<datatransformer xsi:type=" Xmlserializertransformerdata "name=" Xml Serializer Transformer ""
<includetYpes/>
</datatransformer>
</configurationsection>
</configurationsections
<keyalgorithmstorageprovider xsi:nil= "true"/>
</enterpriselibrary.configurationSettings>
<castle>
<facilities>
<facility id= configuration type= CASTLE.FACILITIES.ENTERPR IseLibrary.Configuration.EnterpriseConfigurationFacility, Castle.Facilities.EnterpriseLibrary.Configuration "/
</facilities>
<components>
<component id= editorfontdata type= configuratio Nquickstart.editorfontdata, Castle.Facilities.EnterpriseLibrary.Configuration.Tests "
configurationkey=" Editorsettings "/>
<component id=" Editorservice "type=" Castle.Facilities.EnterpriseLibrary.Configuration . Tests.editorservice, Castle.Facilities.EnterpriseLibrary.Configuration.Tests "/>
</components>
& Lt;/castle>
</configuration>