Castle IOC container practice enterpriselibrary Configuration Facility

Source: Internet
Author: User
Tags xmlns

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>

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.