NHibernate 2.1.2 - 如何禁用反射优化器

时间:2010-09-19 21:42:00

标签: c# nhibernate reflection orm

我想禁用反射优化(测试目的),但我不知道在哪里做。 NH 2.1.2在XML中使用hibernate-configuration,而docs明确指出此设置无法在此处设置。 :/我尝试使用键/值对的旧App.config方式,没有运气......

另外,NH 2+版本是否改变了反射优化的一些内容?

1 个答案:

答案 0 :(得分:0)

你试过吗

<add key="hibernate.use_reflection_optimizer" value="false" />

<小时/> From the Hibernate Community:

  

我能够设置   hibernate.use_reflection_optimizer   web.config文件中的属性为   如下。请注意,设置没有   在...内工作   hibernate-configuration部分,所以我   不得不把它放在一个新的nhibernate   部分。现在的代码似乎是   在中等信任环境中工作   (godaddy)

  <configSections>
    <section name="hibernate-configuration"
             type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
             requirePermission="false"/>
    <section name="nhibernate"
             type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"
             requirePermission="false"/>
  </configSections>

  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
      <property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
      <property name="connection.connection_string">blahblah</property>
      </session-factory>
  </hibernate-configuration>

  <nhibernate>
    <add key="hibernate.use_reflection_optimizer" value="false" />
  </nhibernate>
相关问题