Hi
I'm trying to adapt quick start application to my code. I have MyClass.hbm.xml file
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="package.MyClass, package" table="tableName">
<id name="Id" column="id" type="String" length="20">
<generator class="assigned" />
</id>
<property name="field1" column="field1" type="String" length="90"/>
<property name="field2" type="String" column="field2" length="20"/>
<property name="field3" type="String" column="field3" length="20"/>
</class>
</hibernate-mapping>
and my App,config is looking like that
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
/>
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="Log.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MySQLDialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.MySqlDataDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Server=localhost;Database=myDB;User ID=user;Password=passwd"
/>
</nhibernate>
</configuration>
I have done all things from this tutorial and after
Quote:
Configuration cfg = new Configuration();
cfg.AddAssembly("package");
ISessionFactory factory = cfg.BuildSessionFactory();
I'm getting "Could not find the dialect in the configuration" error. I have moved MySql.cfg.xml.tmpl file from nHibernate to the root location of my application.
I have no idea why MySQLDialect could not be found - please help me, I'm stucked on this issue :(.
Regards
Jan