IOCFactory 2013.10.24版本發佈說明

更新說明:
一、更正以前的unity的mapping xml格式以及讀取方式
二、增長讀取寫在.config文件中的unity格式的section來進行註冊的方式
三、增長了.config文件的section handler.

具體例子表現爲:
setting.xmlgit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0" encoding="utf-8" ?>
<unity>
<typeAliases>
<typeAlias alias="Interface" type="IOCFactoryUnitTest.Animal,IOCFactoryUnitTest"/>
<typeAlias alias="Object" type="IOCFactoryUnitTest.Dog,IOCFactoryUnitTest"/>
</typeAliases>
<containers>
<container name="containerOne">
<types>
<type type="Interface" mapTo="Object">
<lifetime type="singleton"/>
</type>
</types>
</container>
</containers>
</unity>

.configgithub

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="IOCFactory.Util.IOCFactoryUnitySectionHandler,IOCFactory"/>
</configSections>
<unity configSource="setting.xml" />
</configuration>

註冊調用app

1
factory.RegistFromSection( "unity" );

點擊 訪問github獲取本項目的最新代碼ide

相關文章
相關標籤/搜索