我有一个测试项目,我正在尝试使用sql lite内存数据库来测试我的nhibernate层。
我收到了错误:
无法从NHibernate.Driver.SQLite20Driver,NHibernate,Version = 3.1.0.4000,
创建驱动程序private void CreateSessionFactory()
{
_sessionFactory = Fluently
.Configure()
.Database(_dbType)
.Mappings(m => m.FluentMappings
.AddFromAssemblyOf<UserMap>())
.ExposeConfiguration(cfg => _configuration = cfg)
.BuildSessionFactory();
}
我正在使用fluentnhibernate和nunit。
问题是什么?
更新
我从http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki下载了x64(我在Windows 7 64位上),现在我收到了这个错误:
Unable to load DLL 'SQLite.Interop.DLL': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
如果我尝试在vs.net 2010中添加Interop.dll,它不会让我说它无法添加,请确保它是有效的等。
答案 0 :(得分:5)
最新版本的SQLite for .NET分发为2个dll。
两个dll都需要与EXE位于同一个文件夹中。 Interop dll是特定于平台的,因此您必须手动(或后期构建)复制x86或x64版本。
要记住的另一件事是 SQLite.Interop.dll itslef取决于 MSVCR100.DLL (Visual C ++ 2010 SP1可再发行组件包的一部分)。你可以在这里得到它: