2010-07-04 60 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