如何解决使用 MySQL8Dialect 配置 Nhibernate 5.3.8
我在我的 c# 应用程序中更新了 NHibernate 版本和 MysqlData 版本
版本信息
NHibernate 5.3.8
MySqlData 8.0.24.0
在我的hibernate_mysql_config.xml
下面<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="hsms.local">
<property name="connection.driver_class">
NHibernate.Driver.MySqlDataDriver
</property>
<property name="connection.connection_string">
data source=xxxxxx;Database=xxxxxx; User ID=xxxxxxx;Password=xxxxxxxxx;default command timeout=5000; Convert Zero Datetime=true; Allow Zero Datetime=True;
</property>
<property name="adonet.batch_size">
200
</property>
<property name="show_sql">
false
</property>
<property name="connection.isolation">
ReadCommitted
</property>
<property name="dialect">
NHibernate.Dialect.MySQL8Dialect
</property>
<property name="command_timeout">
60
</property>
<property name="query.substitutions">
true 1,false 0,yes 'Y',no 'N'
</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
<mapping assembly="Merqurio.Redazione.DL.Model" />
</session-factory>
</hibernate-configuration>
当我运行我的应用程序时,出现以下错误:
无法加载类型 NHibernate.Dialect.MySQL8Dialect。可能的原因:未指定程序集名称。":""
在stackTrace下面:
at NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName,IDictionary 2 props)
at NHibernate.Dialect.Dialect.GetDialect(IDictionary 2 props)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at Merqurio.Redazione.DAL.Persistance.SessionManagerMySqlDottNet..cctor() in E:\Progetti\Progetti C# Visual Studio\Redazione\trunk\Merqurio.Redazione\Merqurio.Redazione.DAL.Persistence\SessionManagerMySqlDottNet.cs:line 71
我已经检查了方言拼写。怎么了?
解决方法
在配置文件中添加以下行
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。