Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se

Solucionado (ver solução)

NHibernate + SQL Server

Olá pessoal, gostaria de saber se alguém pode ajudar mostrando como seria a configuração do arquivo "hibernate.cfg.xml" para usar com o SQL Server. Desde já obrigado.

3 respostas

Tentei criar assim:

<?xml version="1.0" encoding="utf-8" ?>

NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle NHibernate.Connection.DriverConnectionProvider NHibernate.Driver.SqlClientDriver Data Source=desktop-th74pup\sqlexpress;Initial Catalog=LojaComNHibernate;User ID=sa;Password=123456 NHibernate.Dialect.MsSql2014Dialect true

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
  <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle</property>
  <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
  <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
  <property name="connection.connection_string">Data Source=desktop-th74pup\sqlexpress;Initial Catalog=LojaComNHibernate;User ID=sa;Password=123456</property>
  <property name="dialect">NHibernate.Dialect.MsSql2014Dialect</property>
  <property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
solução

Segue código.....

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration
xmlns="urn:nhibernate-configuration-2.2">
  <session-factory>
    <property name="connection.provider">
      NHibernate.Connection.DriverConnectionProvider
    </property>
    <property name="dialect">
      NHibernate.Dialect.MsSql2012Dialect
    </property>
    <property name="connection.driver_class">
      NHibernate.Driver.SqlClientDriver
    </property>
    <property name="connection.connection_string">
      Server=.\sqlexpress;Database=LojaComNHibernate;User Id=***SeuUser***;Password=***SuaSenha***;
    </property>
    <property name="show_sql">true</property>
  </session-factory>
</hibernate-configuration>