malin2670372 2012年07月18日
求解:NHibernate+SQLite的问题,Could not create the driver
各位大虾帮忙看看,环境为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.
...全文
177 点赞 收藏 4
写回复
4 条回复

还没有回复,快来抢沙发~

发动态
发帖子
C#
创建于2007-09-28

8.4w+

社区成员

64.0w+

社区内容

.NET技术 C#
社区公告
暂无公告