1.
为Microsoft Visual Studio 2008添加编写NHibernate配置文件智能提示的功能。只要在下载的NHibernate里找到configuration.xsd和nhibernate-mapping.xsd两个文件并复制到X:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas目录即可。
2.
NHibernate使用属性的getter和setter来实现持久化。
属性可设置为public、internal、protected、protected internal或private.
要求持久化类不是sealed的,而且其公共方法、属性和事件声明为virtual
3.
hibernate.cfg.xml文件
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHFactory">
<!-- properties -->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=YQKC003\SQLEXPRESS;initial catalog=hotelManageDB;integrated security=sspi</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property><!--数据库方言-->
<property name="use_outer_join">true</property>
<!-- mapping files -->
<mapping assembly="HotelManageModels" /><!--映射整个持久层的程序集-->
</session-factory>
</hibernate-configuration>
完毕!
此配置也可配置在app.config中进行或在类中