【问题标题】:how to set generate_statistics = true with fluent nhibernate如何使用流利的 nhibernate 设置 generate_statistics = true
【发布时间】:2010-10-11 06:39:52
【问题描述】:

据我了解,我最终需要这样做

<property name="hibernate.generate_statistics">true</property>

关于会话工厂配置,但我不知道如何使用流利的 nhibernate 来做到这一点。

【问题讨论】:

    标签: fluent-nhibernate


    【解决方案1】:
    Configuration.ExposeConfiguration(c => c.SetProperty("generate_statistics", "true"));
    

    【讨论】:

      【解决方案2】:

      在 NHibernate 3 中避免使用字符串:

      Configuration.ExposeConfiguration(c => c.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "true"));
      

      【讨论】:

        【解决方案3】:

        根据您配置 Fluent NHibernate 的方式,Database Configuration 有一个 Raw 方法,您可以使用它来指定我们尚未实现的设置。

        SQLiteConfiguration.Standard
          .Raw("hibernate.generate_statistics", "true");
        

        【讨论】:

        • 谢谢。省略休眠部分对我有用: xxxx.Raw("generate_statistics", "true");
        • 但这似乎是使用 Fluent 更自然的方式。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-10-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-09-27
        相关资源
        最近更新 更多