0

Visual Basic 2010 Express 上の VB.NET 用のまともな (そして最近の) NHibernator の例が見つからないようです。しかし、私はできる限りすべてをつなぎ合わせようとしています。

ただし、常にこのエラーが発生するようです。

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.

私はnhibernator.cfg.xml以下を含むプロジェクトのルートにあります

<?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>

任意のヘルプと洞察をいただければ幸いです。

4

2 に答える 2

1

プロジェクトのルートにnhibernator.cfg.xmlがあり、次のものが含まれています

デフォルトで名前を付けたいと思いhibernate.cfg.xmlます。それ以外の場合は、構成で新しいファイルを指定します。

于 2012-04-25T22:47:49.243 に答える
0

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

于 2012-04-25T20:35:27.940 に答える