activereocrd是castle中一orm框架,它對nhibernate做了進一步的封裝。
1.環境搭建
a.程式集引用 (注意各程式集間版本相容性)
castle.activerecord.dll
castle.dynamicproxy2.dll
iesi.connections.dll
nhibernate.dll
nhibernate.bytecode.castle.dll
/* 這一項根據自己需要來選擇不同的延遲載入**工廠
nhibernate.bytecode.castle.dll
nhibernate.bytecode.linfu.dll
nhibernate.bytecode.spring.dll
*/b.配置
可以在應用程式配置檔案和單獨的配置檔案中來進行配置,也可以通過程式設計方式配置
配置項參考nhibernate hibernate.cfg.xml
在應用程式配置檔案中配置
<?在xml檔案中配置xml
version
="1.0" encoding
="utf-8" ?>
<
configuration
>
<
configsections
>
<
section
name
="activerecord"
type
="castle.activerecord.framework.config.activerecordsectionhandler,castle.activerecord"/>
configsections
>
<
activerecord
>
<
config
>
<
add
key="connection.driver_class" value
="nhibernate.driver.sqlclientdriver" />
<
add
key="dialect" value
="nhibernate.dialect.mssql2005dialect"/>
<
add
key="connection.provider" value
="nhibernate.connection.driverconnectionprovider"/>
<
add
key="connection.connection_string" value
="server=.;database=study;uid=sa;pwd=sa"/>
<
add
key="show_sql" value
="true"/>
<
add
key="proxyfactory.factory_class"
value
="nhibernate.bytecode.castle.proxyfactoryfactory, nhibernate.bytecode.castle" />
config
>
activerecord
>
configuration
>
載入配置
iconfigurationsource source = configurationmanager.getsection("activerecord") as iconfigurationsource;
activerecordstarter.initialize(assembly.getexecutingassembly(), source);
<?載入配置xml
version
="1.0" encoding
="utf-8" ?>
<
activerecord
>
<
config
>
<
add
key="connection.driver_class" value
="nhibernate.driver.sqlclientdriver" />
<
add
key="dialect" value
="nhibernate.dialect.mssql2005dialect"/>
<
add
key="connection.provider" value
="nhibernate.connection.driverconnectionprovider"/>
<
add
key="connection.connection_string" value
="server=.;database=study;uid=sa;pwd=sa"/>
<
add
key="show_sql" value
="true"/>
<
add
key="proxyfactory.factory_class" value
="nhibernate.bytecode.castle.proxyfactoryfactory, nhibernate.bytecode.castle" />
config
>
activerecord
>
iconfigurationsource source = new xmlconfigurationsource("xmlfile2.xml");
activerecordstarter.initialize(assembly.getexecutingassembly(), source);
程式設計方式配置
inplaceconfigurationsource source = newinplaceconfigurationsource();
hashtable properties = new
hashtable();
properties.add("connection.driver_class", "nhibernate.driver.sqlclientdriver");
properties.add("dialect", "nhibernate.dialect.mssql2000dialect");
properties.add("connection.provider", "nhibernate.connection.driverconnectionprovider");
properties.add("connection.connection_string", "uid=sa;password=19811218;initial catalog=ardemo;data source=.");
properties.add("proxyfactory.factory_class", "nhibernate.bytecode.castle.proxyfactoryfactory, nhibernate.bytecode.castle");
source.add(typeof(activerecordbase), properties);
activerecordstarter.initialize(assembly.getexecutingassembly(), source);
github pages Jekyll環境搭建
通過jekyll可以搭建 簡單理解成網頁生成規則,就是通過配置能自動幫你生成靜態網頁的東西。如何配置,請看 首先要更新ruby,系統倉庫裡最新的是1.9.3,而jekyll要求 2.0 最終版本資訊 ruby v ruby 2.3.3p222 2016 11 21 revision 56859 x8...
iOS WebDriverAgent 環境搭建
webdriveragent是facebook 在去年的 seleniumconf 大會上推出了一款新的ios移動測試框架。當時的推文申明,還只支援模擬器,不過在今年4月更新的版本中,官方宣稱支援真機測試了,大家可以檢視官方github 的介紹 下面摘錄一段官方對於webdriveragent的介紹...
pytorch tensorflow環境搭建
整個環境搭建鏈結 anaconda cuda 步驟一 安裝anaconda 作用是建立虛擬環境,避免各個環境受版本不同的影響 步驟二 cuda安裝 顯示卡廠商nvidia運算平台 sudo bash cuda 9.0.176 384.81 linux run此處是很長的說明 do you accep...