static void

NHibernate App.Config

When you new Configuration().Configure(), app/web.config is easiest (and the first default). If not found, it looks for hibernate.cfg.xml in the current directory, or you must pass in a path or an IDictionary.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="hibernate-configuration"
             type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory>
      <property name="connection.provider">
        NHibernate.Connection.DriverConnectionProvider
      </property>
      <!-- Change these to Oracle, Sql2000 etc-->
      <property name="connection.driver_class">
        NHibernate.Driver.SqlClientDriver
      </property>
      <property name="dialect">
        NHibernate.Dialect.MsSql2005Dialect
      </property>
      <!-- Connection string or connection string name -->
      <!--<property name="connection.connection_string">Server=.\SQLEXPRESS;Database=Northwind;Integrated Security=True;</property>-->
      <property name="connection.connection_string_name">
        Northwind
      </property>
      <!-- web or thread_static-->
      <property name="current_session_context_class">
        thread_static
      </property>
      <!-- Help debugging-->
      <property name="show_sql">
        true
      </property>
      <!-- NHibernate 2.1 + -->
      <property name="proxyfactory.factory_class">
        NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
      </property>
    </session-factory>
  </hibernate-configuration>
  <connectionStrings>
    <add name="Northwind" connectionString="Server=.\SQLEXPRESS;Database=Northwind;Integrated Security=True;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
</configuration>