NHibernate: Custom Dialect - how to specify the class in a separate assembly

mysql, nhibernate

Solution

<property name="dialect">MyAssembly1.MyDialectClass1, MyAssembly1</property>

Problem

I have a project which uses NHibernate and I have a custom dialect: ``` using System; using System.Collections.Generic; using System.Web; public class NHibernateMySQL5InnoDBDialect : NHibernate.Dialect.MySQL5Dialect { public override String TableTypeString { get { return " ENGINE=InnoDB DEFAULT CHARSET=utf8"; } } } ``` I have a separate assembly for this class: Assembly1. Assembly1 is built into the directory where NHibernate.dll is. In my cfg file I added: ``` <property name="dialect">Assembly1.NHibernateMySQL5InnoDBDialect</property> ``` When I run my app I get the following error: ` NHibernate.MappingException: Could not compile the mapping document: XXX.hbm.xml ---> NHibernate.HibernateException: Could not instantiate dialect class Assembly1.NHibernateMySQL5InnoDBDialect ---> System.TypeLoadException: Could not load type Assembly1.NHibernateMySQL5InnoDBDialect. Possible cause: no assembly name specified. at NHibernate.Util.ReflectHelper.TypeFromAssembly (NHibernate.Util.AssemblyQualifiedTypeName name, Boolean throwOnError) [0x00000] in :0 ` I'm sure there is an obvious explanation for this but I'm stuck at the moment - could you help? Regards Tymek

Original source