NHibernate配置文件连接SqlServer数据库

最近研究了一下NHibernate,NHibernate配置文件如何连接SqlServer,下面附上配置文件(hibernate.cfg.xml)源码供参考。

hibernate.cfg.xml内容如下:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
 <session-factory name="NHibernateDemo">
    <!-- 连接SqlServer -->
  <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
  <property name="connection.connection_string">
      Server=localhost;
      Initial Catalog=projectData;
      User Id=sa;Password=123456;Persist Security Info=true
    </property>
  <property name="adonet.batch_size">10</property>
  <property name="show_sql">false</property>
    <!-- 连接SqlServer (以msSql2005为例)-->
  <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
  <property name="use_outer_join">true</property>
  <property name="command_timeout">10</property>
  <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
  <mapping assembly="Model"/>
 </session-factory>
</hibernate-configuration>

你可能感兴趣的:(String,Security,command,assembly,sqlserver,encoding)