我有一个使用NHibernate的项目,我有一个自定义方言:
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"; } }
}
我为这个类有一个单独的程序集:Assembly1。 Assembly1内置于NHibernate.dll所在的目录中。
在我的cfg文件中,我添加了:
<property name="dialect">Assembly1.NHibernateMySQL5InnoDBDialect</property>
当我运行我的应用时,我收到以下错误:
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
我确信有一个明显的解释,但我现在卡住了 - 你能帮忙吗?
此致 Tymek
答案 0 :(得分:8)
<property name="dialect">MyAssembly1.MyDialectClass1, MyAssembly1</property>