2011-09-21 35 views
0

司機我有我試圖使用SQL精簡版的內存數據庫來測試我的NHibernate層一個測試項目。無法創建NHibernate.Driver.SQLite20Driver,NHibernate的,版本= 3.1.0.4000

,我發現了錯誤:

無法創建NHibernate.Driver.SQLite20Driver,NHibernate的,版本= 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也。

問題是什麼?

更新

我下載了64(我在Windows 7 64位)從http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki,現在我收到此錯誤:如果我嘗試添加

Unable to load DLL 'SQLite.Interop.DLL': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 

在vs.net 2010中的Interop.dll,它不會讓我說它不能被添加,請確保它是有效的。

回答

5

最新版本的SQLite for .NET以2個dll的形式發佈。

  • System.Data.SQLite.dll
  • SQLite.Interop.dll

兩個DLL文件必須存在於同一文件夾中的EXE。 Interop dll是平臺特定的,因此您必須手動(或後製)複製x86或x64版本。

另一件事要記住的是,SQLite.Interop.dll itslef取決於MSVCR100.DLL(VISUAL C++ 2010 SP1再發行組件包的一部分)。你可以在這裏得到它:

+0

爲什麼拒絕我時,通過「添加引用」添加它添加到我的項目的任何想法,sql.data.sqlite加罰款。 – Blankman

+1

* SQLite.Interop.dll *不是託管的DLL,您不能將其添加爲.NET項目的引用。它應該手動複製。 – Dmitry

+1

這不再適用。如果你在windows上運行sqlite安裝程序,它將構建入主System.Data.SQLite.dll的ineterop。這是你需要帶到派對上的唯一東西 –