2012-04-25 11 views
0

Visual Basic 2010 ExpressでVB.NET用のまともな(そして最近の)NHibernatorのサンプルが見つかりません。しかし、私はできる限りのことをまとめようとしています。VB.NET NHibernate設定

しかし、私は常にこのエラーが発生するようです。

A first chance exception of type 'System.IO.FileNotFoundException' occurred in System.Xml.dll 
A first chance exception of type 'NHibernate.Cfg.HibernateConfigException' occurred in NHibernate.dll 
A first chance exception of type 'NHibernate.Cfg.HibernateConfigException' occurred in NHibernate.dll 
a: An exception occurred during configuration of persistence layer. 

私は任意の助けと洞察力が高く評価され、次の

<?xml version="1.0" encoding="utf-8" ?> 
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> 

    <!-- For simplicity, the NHibernate configuration is stored in this file. 
    It must be named hibernate.cfg.xml and marked in Visual Studio to be copied 
    to the output folder. --> 

    <session-factory> 

    <!-- By default NHibernate is aggressive in closing connections between 
    SQL statments. This unfortunately causes a problem when reading ID 
    numbers assigned by Access (e.g. in AutoNumber fields). See comments 
    in the Test 1 section of Program.cs. --> 

    <property name="hibernate.connection.release_mode">on_close</property> 

    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> 
    <property name="dialect">NHibernate.JetDriver.JetDialect, NHibernate.JetDriver</property> 
    <property name="connection.driver_class">NHibernate.JetDriver.JetDriver, NHibernate.JetDriver</property> 

    <!-- The Sample.mdb file is located in the folder containing the 
    solution file. This is three folders upward. Relative paths 
    are supported in Jet connection strings. --> 

    <property name="connection.connection_string">Provider=Microsoft.ACE.OLEDB.12.0;Data Source=database.accdb</property> 
    </session-factory> 
</hibernate-configuration> 

を含むプロジェクトのルートにnhibernator.cfg.xmlを持っています。

+0

'hibernate.connection.release_mode'プロパティは、' xsd'シートに従って無効だったので、これを削除しました。まだ同じエラー。 – klj613

+0

あなたのapp.configファイルまたはweb.configファイルの内容は何ですか?初期設定ファイルの設定を使用して、休止状態の構成ファイルの読み込み先を制御したり、app.config内に構成全体を配置することができます。 – Min

答えて

1

私は私はあなたがデフォルトでhibernate.cfg.xmlにそれを名前を付けたいと思います次

を含むプロジェクトのルートにnhibernator.cfg.xmlを持っています。それ以外の場合は、新しいファイルを設定します。

0

出力フォルダにファイルをコピーするように設定されていますか?これはVisual Studioのプロパティにあります。常にコピーするように設定する必要があります。

+0

これは 'copy always'に既に設定されています – klj613

関連する問題