2009-09-22 81 views
4

SQLLite的哪個版本/實現可以與NHibernate一起使用。我得到一個錯誤:SQL.Data.SqlLite版本與NHibernate 2.1

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 element in the application configuration file to specify the full name of the assembly.

讓我說,dll位於bin目錄中,我做了肯定。 我正在使用System.Data.SQLite.DLL版本1.0.60.0。

這裏是hibernate.cfg.xml中

<property name="connection.driver_class"> 
     <!--NHibernate.Driver.SqlClientDriver--> 
     NHibernate.Driver.SQLiteDriver 
    </property> 
    <property name="connection.connection_string"> 
     <!-- Server=.\SQLEXPRESS;User Id=epitka;Password=password;Database=dnn49;--> 
     Data Source=nhibernate.db;Version=3 
    </property> 
    <property name="dialect">NHibernate.Dialect.SQLiteDialect</property> 

    <property name="query.substitutions">true=1;false=0</property> 

    <property name="show_sql">true</property> 

我在Windows XP操作系統運行框中這一點。

回答

3

IDbCommand和IDbConnection位於System.Data命名空間中,不在SQLite中。你會發布你的nhibernate配置設置嗎?

這裏是相關設置

dialect = NHibernate.Dialect.SQLiteDialect, NHibernate 
connection.driver_class = NHibernate.Driver.SQLite20Driver, NHibernate 

SQLite20Driver是System.Data.SQLite,而SQLiteDriver是SQLite.NET。所以SQLite20Driver是你的答案。

3

我在Windows 7上有同樣的問題x64,如果是這樣的話;下載SQLite的二進制發行版(http://sqlite.phxsoftware.com/)並引用x64版本。

2

謎解決:

如果你從NHibernate的的lib \ NHibernate的\ Configuration_Templates文件夾中的配置模板,他們就得從這個網址 http://sourceforge.net/projects/adodotnetsqlite/這是SQLite和司機是NHibernate.Driver得到sqllite的dll .SQLiteDriver。但正如網站所說,這個項目已經死亡。

所以,你去從這個網址或從FluentNhibernate lib文件夾 http://sourceforge.net/projects/sqlite-dotnet2/和驅動程序下載新System.Data.SQLite.DLL是NHibernate.Driver.SQLite20Driver

看到,在驅動程序名20?

無論如何,雖然我可能會澄清這個謎。

0

得到這個錯誤試圖在VS2010中與SQLite的Castle ActiveRecord。解決它按照此指示並將目標框架從.NET 4更改爲.NET 3.5

1

我得到了這個,但它只是簡單地說,我不會在我的測試項目中引用我的CopyLocal = True。

0

我也遇到過這個錯誤,這真的讓我發瘋。但我解決它。並與您分享,可以幫助您 See this Link

+1

歡迎來到堆棧溢出!雖然這可能在理論上回答這個問題,[這將是更可取的](http://meta.stackexchange.com/q/8259)在這裏包括答案的重要部分,並提供供參考的鏈接。 – Spontifixus 2012-11-01 09:29:05