Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I setup NHibernate with Visual Studio and Firebird?
    text
    copied!<p>I'm trying to set up a small app to experiment with NHibernate in visual studio but I'm not getting far. </p> <p>The error I get is: "Could not find the dialect in the configuration".</p> <p>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.</p> <p>I've looked at various examples on the net but can't get it sorted ... Does anyone know what the problem could be?</p> <p>Here is my application source,app.config and hibernate.cfg.xml</p> <h2>Application Source</h2> <pre><code>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(); } } } </code></pre> <h2>App.Config</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt; &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /&gt; &lt;/configSections&gt; &lt;nhibernate&gt; &lt;add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /&gt; &lt;add key="hibernate.dialect" value="NHibernate.Dialect.FirebirdDialect" /&gt; &lt;add key="hibernate.connection.driver_class" value="NHibernate.Driver.FirebirdClientDriver" /&gt; &lt;add key="hibernate.connection.connection_string" value="User=sysdba;Password=masterkey;Database=C:\X\Test\Timer\Timer.FDB;Dialect=3;ServerType=1;" /&gt; &lt;/nhibernate&gt; &lt;log4net debug="false"&gt; &lt;!-- Define some output appenders --&gt; &lt;appender name="trace" type="log4net.Appender.TraceAppender, log4net"&gt; &lt;layout type="log4net.Layout.PatternLayout,log4net"&gt; &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;appender name="console" type="log4net.Appender.ConsoleAppender, log4net"&gt; &lt;layout type="log4net.Layout.PatternLayout,log4net"&gt; &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" &gt; &lt;param name="File" value="h:\log.txt" /&gt; &lt;param name="AppendToFile" value="false" /&gt; &lt;param name="RollingStyle" value="Date" /&gt; &lt;param name="DatePattern" value="yyyy.MM.dd" /&gt; &lt;param name="StaticLogFileName" value="true" /&gt; &lt;layout type="log4net.Layout.PatternLayout,log4net"&gt; &lt;param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;!-- Setup the root category, add the appenders and set the default priority --&gt; &lt;root&gt; &lt;priority value="DEBUG" /&gt; &lt;appender-ref ref="console" /&gt; &lt;/root&gt; &lt;logger name="NHibernate"&gt; &lt;level value="DEBUG" /&gt; &lt;/logger&gt; &lt;/log4net&gt; &lt;runtime&gt; &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt; &lt;qualifyAssembly partialName="FirebirdSql.Data.FirebirdClient" fullName="FirebirdSql.Data.FirebirdClient, Version=2.0.1.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" /&gt; &lt;/assemblyBinding&gt; &lt;/runtime&gt; &lt;/configuration&gt; </code></pre> <h2>hibernate.cfg.xml</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt; &lt;/configSections&gt; &lt;nhibernate&gt; &lt;add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /&gt; &lt;add key="hibernate.dialect" value="NHibernate.Dialect.FirebirdDialect" /&gt; &lt;add key="hibernate.connection.driver_class" value="NHibernate.Driver.FirebirdClientDriver" /&gt; &lt;add key="hibernate.connection.connection_string" value="User=sysdba;Password=masterkey;Database=C:\X\Test\Timer\Timer.FDB;Dialect=3;ServerType=1;" /&gt; &lt;/nhibernate&gt; &lt;/configuration&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload