【问题标题】:What is isWeb attribute for in Castle ActiveRecordCastle ActiveRecord 中的 isWeb 属性是什么
【发布时间】:2010-09-17 16:08:04
【问题描述】:

官方文档说:

如果 ActiveRecord 在 ASP.Net 应用程序中运行,则必须添加此属性,值为 true

所以我很自然地打开它并立即注意到那些使用 ActiveRecord 访问数据库的后台线程(使用 Quartz.net)崩溃,因为它们在没有 HttpContext 时尝试访问 HttpContext。

解说部显然缺少官方的“解说”!所以考虑到我上面提到的几点,isWeb 有什么用,我为什么要打开它?

【问题讨论】:

    标签: nhibernate castle-activerecord


    【解决方案1】:

    isWeb="true" 只是 threadinfotype="Castle.ActiveRecord.Framework.Scopes.WebThreadScopeInfo, Castle.ActiveRecord" 的简写

    WebThreadScopeInfo 使用 HttpContext 作为 sessionscope 存储。如果您的代码需要在任何 HttpContext 之外使用 ActiveRecord(例如 Quartz.Net 作业),请改用 HybridWebThreadScopeInfo。当你定义一个特定的threadscopeinfo类来使用时,不需要设置isWeb

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-05
      • 2010-12-01
      • 1970-01-01
      相关资源
      最近更新 更多