0
我使用Nhibernate與nperistence api和實體框架。下面是我的persistence.xml內存db中的SQLite無法正常工作。表未找到錯誤
<provider>NPersistence.NHibernate.NHibernatePersistence</provider>
<class>CSharp.Node </class>
<class>CSharp.Edge</class>
<properties>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
<property name="connection.connection_string">Data Source=:memory:</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="connection.release_mode"> on_close </property>
<property name="query.substitutions">true=1;false=0</property>
<property name="hbm2ddl.auto" value="update"/>
</properties>
我的節點類:
using System;
using NPersistence;
namespace CSharp
{
[Entity]
[Table(Name = "edge")]
public class Edge
{
[Id]
[GeneratedValue]
public virtual int edgeId { get; set;}
public virtual int fromnode{ get; set; }
public virtual int tonode { get; set;}
public virtual string edgelabel{ get; set;}
public Edge(){
}
}
}
在大多數我找到了教程,設置connection_string =:內存:應該工作。但是當我運行我的項目時,查詢分貝我得到以下錯誤
NPersistence.PersistenceException: could not execute query
no such table: edge
如何導出模式?我是新來的。我以前使用Sqlite(基於文件)和myql db,我沒有明確地導出數據庫。我只是更改了persistence.xml文件而不更改代碼 –