nhibernate中config的配置

在网上查找很多文章之后做出来了第一个nhibernate程序:

如下是config的配置方法:

<configuration>

<configSections>

  <section name="hibernate-configuration"
          type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />

</configSections>

</configuration>

...

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory name="NHibernate.TestDatabaseSetup">
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">
        Server=(local);initial catalog=nhibernate;Integrated Security=SSPI
      </property>
      <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
      <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    </session-factory>
  </hibernate-configuration>
红色字体根据自己连接的数据库已经sql版本来进行修改。

原文地址:https://www.cnblogs.com/guozhenyp/p/2110523.html