NHibernate错误:严重性代码描述项目文件行抑制状态错误无法识别的配置部分会话工厂

时间:2018-03-07 19:15:53

标签: c# nhibernate

我正在尝试将我的应用程序连接到sql server 2012数据库,但它不起作用并且它给出了标题上显示的错误,有人可以帮助我吗?这是代码:

`

<?xml version="1.0"?>
    <configuration>
      <!-- an ISessionFactory instance -->
      <session-factory>
        <!-- properties -->
        <property name="connection.connection_string">
          User ID=****;Password=****;Data Source=****;Initial Catalog=****;
        </property>
        <property name="show_sql">false</property>
        <property name="dialect">NHibernate.Dialect.MsSql2012Dialect</property>
        <!-- mapping files -->
        <mapping resource="NHibernate.Auction.Item.hbm.xml" assembly="NHibernate.Auction"/>
        <mapping resource="NHibernate.Auction.Bid.hbm.xml" assembly="NHibernate.Auction"/>
      </session-factory>
      <system.web>
        <compilation debug="true"/>
      </system.web>
    </configuration>

`

1 个答案:

答案 0 :(得分:0)

检查文档以获取更多配置示例

Chapter 23. Example: Weblog Application

以下是此类设置的摘要(请查看 <configSections>

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <!-- Add this element -->
  <configSections>
    <section
        name="hibernate-configuration"
        type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>

  <!-- Add this element -->
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>