NHibernate ADO.NET 屬性

來源:互聯網
上載者:User

Property name Purpose
connection.provider_class The type of a custom IConnectionProvider.

eg. full.classname.of.ConnectionProvider if the Provider is built
into NHibernate, or full.classname.of.ConnectionProvider,
assembly if using an implementation of IConnectionProvider not included in NHibernate.

connection.driver_class The type of a custom IDriver, if using DriverConnectionProvider.

full.classname.of.Driver if the Driver is built into
NHibernate, or full.classname.of.Driver, assembly if
using an implementation of IDriver not included in NHibernate.

This is usually not needed, most of the time the dialect will take care of setting the IDriver using a sensible default. See the API documentation
of the specific dialect for the defaults.

connection.connection_string Connection string to use to obtain the connection.
connection.connection_string_name The name of the connection string (defined in <connectionStrings> configuration file element) to use
to obtain the connection.
connection.isolation Set the ADO.NET transaction isolation level. Check System.Data.IsolationLevel for meaningful values and the
database's documentation to ensure that level is supported.

eg. Chaos, ReadCommitted,
ReadUncommitted, RepeatableRead, Serializable, Unspecified

connection.release_mode Specify when NHibernate should release ADO.NET connections. See Section 10.7,
“Connection Release Modes”.

eg. auto (default) | on_close | after_transaction

Note that this setting only affects ISessions returned
from ISessionFactory.OpenSession. For ISessions obtained through ISessionFactory.GetCurrentSession, the ICurrentSessionContext implementation configured for use
controls the connection release mode for those ISessions.
See Section 2.3,
“Contextual Sessions”.

command_timeout Specify the default timeout of IDbCommands generated
by NHibernate.
adonet.batch_size Specify the batch size to use when batching update statements. Setting this
to 0 (the default) disables the functionality. See Section 17.6, “Batch
updates”.

NHibernate ADO.NET 屬性

屬性名稱 用途
connection.provider_class 實現IConnectionProvider介面的類型。

例如: (如果是NHibernate內部的IConnectionProvider實作類別)full.classname.of.ConnectionProvider,(如果是自訂的NHibernate外部的IConnectionProvider實作類別 )full.classname.of.ConnectionProvider, assembly。

connection.driver_class 如果使用DriverConnectionProvider,實現IDriver介面的類型。

(如果是NHibernate內部的實現的IDriver類型)full.classname.of.Driver
(如果是自訂的NHibernate外部的IDriver實作類別 )full.classname.of.Driver,
assembly。

這個配置通常是不需要配置的,如果設定好了hibernate.dialect一般會自動選好對應的IDriver。 詳細的dialect與IDriver的預設對應關係可以查看API文檔。

connection.connection_string 資料庫連接字串
connection.connection_string_name 資料庫連接字串名稱(定義在.Net設定檔<connectionStrings>配置節裡面的連接字串名。
connection.isolation ADO.NET交易隔離等級, 查看System.Data.IsolationLevel類來瞭解各個值的具體意義, 但請注意多數資料庫都不支援所有的隔離等級.

例如: Chaos, ReadCommitted,
ReadUncommitted, RepeatableRead, Serializable, Unspecified

connection.release_mode 指定ADO.NET何時釋放資料庫連接。查看10.7 串連釋放模式.

例如: auto (預設) | on_close | after_transaction

注意,這些設定僅對通過ISessionFactory.OpenSession得到的ISession起作用。對於通過ISessionFactory.GetCurrentSession得到的ISession, 所配置的ICurrentSessionContext實現控制這些ISession的串連釋放模式。 請參閱2.3. 上下文相關的(Contextual)Session擷取更多資訊。

command_timeout 指定NHibernate產生的IDbCommands對象的逾時時間。 .
adonet.batch_size 指定用ADO.Net的批次更新的數量,預設設定為0(不啟用該功能)。請參閱 16.6. 批次更新.

下面是一個如何在web.config裡如何設定資料庫連接屬性的例子: 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.