求解:NHibernate+SQLite的问题,Could not create the driver

malin2670372 2012-07-18 11:10:13
各位大虾帮忙看看,环境为framework2.0,NHibernate.dll为1.2版本..NHibernate+SQLite的问题
Configuration cfg = new Configuration().Configure(@"H:\WORK\Item\hibernate.cfg.xml");
return cfg.BuildSessionFactory();//这里会报错,
//Could not load type NHibernate.Driver.SQLiteDriver. Possible cause: no assembly name specified.

hibernate.cfg.xml 如下
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="MySessionFactory">
<!-- properties -->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLiteDataDriver</property>
<property name="connection.connection_string">Data Source=H:\WORK\Item\bin\ItemDB.db;Version=3</property>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="use_outer_join">true</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<mapping assembly="SendbbsEntity" />
</session-factory>
</hibernate-configuration>
</configuration>

在DEBUG目录下放了System.Data.SQLite.DLL文件(3.0)
错误:The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. Ensure that the assembly SQLite.NET is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
...全文
267 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
huluhome 2012-11-01
  • 打赏
  • 举报
回复
终于搞定了,原因是配置文件不能这么配置,我勒个去了。这是我的解决方法,大家参考一下
http://www.huluhome.com/page/Details/4058
huluhome 2012-10-31
  • 打赏
  • 举报
回复
楼主你们是怎么解决的,谢谢啊,我也遇到了这样的问题
Enterprise 2012-07-18
  • 打赏
  • 举报
回复
查看SQLite 是否安装,
我遇见过,引用了SQLite.dll,可是必须在本地安装下,才能用,不知道怎么会事情。
malin2670372 2012-07-18
  • 打赏
  • 举报
回复
?100分也没人....

110,570

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧