【发布时间】:2014-10-20 03:19:43
【问题描述】:
我用单声道 (C#) 编写了一个简单的应用程序,它使用 NHibernate 和 MYSQL - 我现在想将它移植到 SQLite。
我希望(曾经)我可以简单地更改 hibernate.cfg.xml 并将其指向不同的数据库。这是我修改后的hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">
Data Source=nhibernate_test.db;Version=3
</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="query.substitutions">true=1;false=0</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
问题是我收到一个错误,它无法找到 System.Data.SQLite。这并不让我感到惊讶,因为据我了解,在单声道中我们应该使用 Mono.Data.SQLite。
问题是(假设我正确理解了问题)我不知道如何告诉 NHibernate 使用 Mono.Data.SQLite 而不是 System.Data.SQLite。
这一切都在 Linux 上完成 - 如果这有什么不同的话。
有人知道如何进行吗?
【问题讨论】:
标签: c# nhibernate sqlite mono