文档介绍:NHibernate Step by Step (三) Configuration和Sessionfactory
日期:2007年04月10日 来源:BLOG 作者:abluedog 添加:伊扬得分: 难度:
NHibernate Step by Step (三) Configuration和Sessionfactory
好了,我们再从头看一看Configuration,??
当然不是了,以下是3种最常见的配置:
<1> Configuration config = new Configuration();
这种配置方法将会到应用程序配置文件(,)中查找NHibernate的配置信息,NHibernate的配置节必须符合应用程序配置文件个格式,前面的教程我们已经看到过了。
<2> Configuration config = new Configuration().Configure();
这种配置方法将会在应用的相同目录查找名为””的标准Hibernate配置
文件,格式如下:
<?xmlversion=""encoding="utf-8"?>
<hibernate-configurationxmlns="urn:nhibernate-configuration-">
<session-factoryname="MySessionFactory">
<!--properties-->
<propertyname=""></property>
<propertyname=""></property>
<propertyname="">Server=localhost;initialcatalog=Hibernate;IntegratedSecurity=SSPI</property>
<propertyname="show_sql">false</property>
<propertyname="dialect"></property>
<propertyname="use_outer_join">true</property>
<propertyname="">true1,false0,yes'Y',no'N'</property>
<!--mappingfiles-->
<mappingassembly=""/>
</session-factory>
</hibernate-configuration>
<3> Configuration config = new Configuration().Configure(configFil