2010-07-04 59 views
0

我遇到了越來越NHibernate的發揮好與SQLite的問題:NHibernate和SQLite的愁楚

<NHibernate> 
    <hibernate xmlns="urn:nhibernate-configuration-2.2"> 
    <session-factory> 
     <property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property> 
     <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> 
     <property name="connection.connection_string">Data Source=test.db;New=True;</property> 
     <property name="show_sql">false</property> 
     <property name="dialect">NHibernate.Dialect.SQLiteDialect</property> 
     <property name="use_outer_join">true</property> 
     <property name="show_sql">false</property> 
     <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property> 
     <mapping assembly="SimpleGallery" /> 
    </session-factory> 
    </hibernate> 
</NHibernate> 

我在Windows 7 64位運行:

我的NHibernate的配置。我已經嘗試將x86和64位版本的system.data.sqlite.dll複製到輸出目錄以及引用它們並將它們設置爲複製本地但無濟於事。 VS解決方案已被設置爲編譯到任何/ x86/64位,但我仍然得到例外:

「{」無法找到程序集System.Data.SQLite中的IDbCommand和IDbConnection實現。確保程序集System.Data.SQLite位於應用程序目錄或全局程序集緩存中。如果程序集位於GAC中,則使用應用程序配置文件中的元素指定程序集的全名。「}」

我缺少什麼?

+0

不知道是否有幫助,但你可以嘗試下載尖銳建築項目,它有它配置SQL精簡版。 – Sly 2010-07-05 09:05:47

回答

2

我在4月份重新找回了它,並最終找到了它 - PITA!嘗試更改您的配置以支持混合加載並添加如下的運行時重定向。

我會盡管現在有一個SQLite版本可以解決這個問題,但我想不是。請讓我知道,如果你發現不然。

乾杯,
Berryl

<!-- SQLite requires this mixed mode load setting--> 
<startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    <requiredRuntime version="v4.0.20506"/> 
</startup> 

    <runtime> 
    .... 

    <!-- SQLite is built with older System.Data so we need this redirect --> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
    <dependentAssembly> 
     <assemblyIdentity name="System.Data" publicKeyToken="b77a5c561934e089"/> 
     <bindingRedirect oldVersion="2.0.0.0" newVersion="4.0.0.0"/> 
    </dependentAssembly> 
    </assemblyBinding> 

.... 
</runtime> 
+0

你救了我的一天!我同意它應該至少用粗體字 - 4.0已經出來一段時間了... – Goblin 2010-07-06 08:47:33