我遇到了用sqlite設置nHibernate的實際問題。nHibernate和sqlite映射
這裏是hibernate.cfg.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.SQLite20Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">Data Source=books.db;Version=3</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="query.substitutions">true=1, false=0</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
</session-factory>
</hibernate-configuration>
,這裏是(簡化)的映射文件:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly ="DataAccess" namespace="DataAccess.DOM">
<class name="Book" table="book">
<id name="id" type="integer" unsaved-value="null">
<generator class="increment"/>
</id>
<property name="isbn" type="string" length="25"/>
<property name="author" type="string" length="100"/>
</class>
</hibernate-mapping>
表:
create table book(
id INTEGER primary key,
author TEXT,
isbn TEXT,
);
我得到錯誤: 「無法編譯映射文檔:DataAccess.DOM.Book.hbm.xml」
我在Vista 32bit上開發VS2008。
我已經添加了System.Data.SQlite程序集並設置爲複製本地。
有什麼建議嗎?
我已經 – 2009-10-06 11:21:30
仍然嵌在hbm.xml文件中的應用程序了與SqlServerCE工作作爲數據庫,但我嘗試切換到SQLite的。得到這個錯誤。 – 2009-10-06 11:22:09