【发布时间】:2010-02-18 21:42:11
【问题描述】:
我在使用 sqlite 设置 nHibernate 时遇到了真正的问题。
这里是 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"
我在 VS2008 上开发 Vista 32 位。
我已添加 System.Data.SQlite 程序集并设置为复制本地。
有什么建议吗?
【问题讨论】:
标签: visual-studio-2008 nhibernate sqlite nhibernate-mapping mapping