NHibernate加载错误消息

NHibernate加载错误消息,nhibernate,Nhibernate,我收到带有MappingnHibernateeException的错误消息: {“无法编译映射文档:Infrastructure.DataAccess.Mappings.Post.hbm.xml”} 至于 Configuration configuration = new Configuration() .AddAssembly("Infrastructure"); _sessionFactory = configuration

我收到带有MappingnHibernateeException的错误消息:

{“无法编译映射文档:Infrastructure.DataAccess.Mappings.Post.hbm.xml”}

至于

  Configuration configuration = new Configuration()
                .AddAssembly("Infrastructure");
                _sessionFactory = configuration.BuildSessionFactory();
怎么了


hibernate.cfg.xml

    <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory>    
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver </property>
    <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
    <property name="connection.connection_string">Server=localhost\SQLServer2005;database=NHibernate101;Integrated Security=True;</property>
    <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    <mapping assembly="Infrastructure"></mapping>
  </session-factory>
</hibernate-configuration>

NHibernate.Connection.DriverConnectionProvider
NHibernate.Driver.SqlClientDriver
NHibernate.dialogue.mssql2000方言
Server=localhost\SQLServer2005;数据库=NHibernate101;综合安全=真实;
NHibernate.ByteCode.Castle.proxyFactory,NHibernate.ByteCode.Castle

试试这个。在app.config文件中:

<configuration>
  <configSections>
    <section
        name="hibernate-configuration"
        type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
        />
  </configSections>

  <!-- Replace with your values -->
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.connection_string">Data Source=data.db3;Version=3</property>
      <property name="connection.driver_class">NHibernate.Driver.SQLite20Driver, NHibernate</property>
      <property name="show_sql">true</property>
      <property name="adonet.batch_size">0</property>
      <property name="default_batch_fetch_size">0</property>

      <mapping assembly="Infrastructure" />
    </session-factory>
  </hibernate-configuration>

</configuration>

试试这个。在app.config文件中:

<configuration>
  <configSections>
    <section
        name="hibernate-configuration"
        type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
        />
  </configSections>

  <!-- Replace with your values -->
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.connection_string">Data Source=data.db3;Version=3</property>
      <property name="connection.driver_class">NHibernate.Driver.SQLite20Driver, NHibernate</property>
      <property name="show_sql">true</property>
      <property name="adonet.batch_size">0</property>
      <property name="default_batch_fetch_size">0</property>

      <mapping assembly="Infrastructure" />
    </session-factory>
  </hibernate-configuration>

</configuration>

我正在使用一个hibernate.cfg.xml文件,在该文件中,我已…查看编辑的部分…我是否需要执行其他操作?我正在使用一个hibernate.cfg.xml文件,在该文件中,我已…查看编辑的部分…我是否需要执行其他操作?
var cfg = new Configuration().Configure();
var factory = cfg.BuildSessionFactory();