I'm trying to set up a small app to experiment with NHibernate in visual studio but I'm not getting far.
The error I get is: "Could not find the dialect in the configuration".
I've tried specifying settings in both app.config and hibernate.cfg.xml but neither seems to work. These files are in the same directory as my app source (tried other directories too). I've tried setting the build action on hibernate.cfg.xml as "embedded resource" but that didn't help either. I get the same error message even if I completely remove these config files.
I've looked at various examples on the net but can't get it sorted ... Does anyone know what the problem could be?
Here is my application source,app.config and hibernate.cfg.xml
Application Source
using NHibernate;
using NHibernate.Cfg;
namespace Timer
{
public partial class Form1 : Form
{
Configuration cfg;
ISessionFactory factory;
ISession session;
ITransaction transaction;
public Form1()
{
cfg = new Configuration();
//cfg.AddAssembly("Timer");
//cfg.AddFile("WorkoutSet.hbm.xml");
factory = cfg.BuildSessionFactory();
session = factory.OpenSession();
transaction = session.BeginTransaction();
InitializeComponent();
}
}
}
App.Config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
<section
name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"
/>
</configSections>
<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.FirebirdDialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.FirebirdClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="User=sysdba;Password=masterkey;Database=C:\X\Test\Timer\Timer.FDB;Dialect=3;ServerType=1;"
/>
</nhibernate>
<log4net debug="false">
<!-- Define some output appenders -->
<appender name="trace"
type="log4net.Appender.TraceAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>
<appender name="console"
type="log4net.Appender.ConsoleAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>
<appender name="rollingFile"
type="log4net.Appender.RollingFileAppender,log4net" >
<param name="File" value="h:\log.txt" />
<param name="AppendToFile" value="false" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy.MM.dd" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default priority -->
<root>
<priority value="DEBUG" />
<appender-ref ref="console" />
</root>
<logger name="NHibernate">
<level value="DEBUG" />
</logger>
</log4net>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="FirebirdSql.Data.FirebirdClient"
fullName="FirebirdSql.Data.FirebirdClient, Version=2.0.1.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
</assemblyBinding>
</runtime>
</configuration>
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
</configSections>
<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.FirebirdDialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.FirebirdClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="User=sysdba;Password=masterkey;Database=C:\X\Test\Timer\Timer.FDB;Dialect=3;ServerType=1;"
/>
</nhibernate>
</configuration>