. net 3.5中的NHibernate + SQLite问题

本文关键字:SQLite 问题 NHibernate 中的 net | 更新日期: 2023-09-27 18:10:24

我在使用NHibernate和SQLite的SharpDevelop工作时遇到了问题。我看到有人在Visual Studio 2010使用。net 4.0时遇到了与我相同的问题,但我使用。net 3.5,以前从未遇到过这些问题。

我正在做一些单元测试,每当我试图通过NHibernate打开到DB的连接时,抛出以下异常:

SetUp : StructureMap.StructureMapException : StructureMap Exception Code:  207
Internal exception while creating Instance '55c9fa8e-fa79-4698-8d06-7e305e73ac49' of PluginType SimplEconomics.Data.NHibernate.UnitOfWork.INHibernateUnitOfWork.  Check the inner exception for more details.
      ----> FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

  ----> NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
  ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> NHibernate.HibernateException : The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found. Ensure that the assembly System.Data.SQLite 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. - d:'Builds'FluentNH'src'FluentNHibernate'Cfg'FluentConfiguration.cs:93

我认为这是最后一行最具体的,奇怪的是,我第一次有我的项目在。net 4.0(使用最新版本的Sharpdevelop, 4),我可以理解有一些问题与最新的SQLite发布,但这是与。net 3.5,我以前用过它。

有人有什么想法吗?

这是我的规格:

  • SharpDevelop 3.2.1
  • SQLite 1.0.74.0
  • NHibernate 2.1.2.4000
  • 。安装了。NET 4.0和3.5
  • Windows Vista(如果重要的话)

这简直要把我逼疯了…

编辑:我应该补充说,我已经尝试了以下解决方案,但没有成功:类似的stackoverflow-thread

. net 3.5中的NHibernate + SQLite问题

确保您的SQLite DLL复制到您的/bin目录。另外,需要注意的是,SQLite与Win操作系统无关,有32位和64位版本可用,在使用它的操作系统上使用适当的版本。SQLite回家。