c# - 有没有办法停止 OnItemSaving 事件?

标签 c# sitecore sitecore6 sitecore7

我已经设法停止通过使用

触发的 OnItemSaved 事件
item.Editing.EndEdit(false,true);

但这仍然会触发 OnItemSaving 事件。还有办法禁用它吗?

最佳答案

您可以使用 EventDisabler 来做到这一点:

using (new EventDisabler())
{
    item.Editing.BeginEdit();
    item.Editing.EndEdit();
}

在这里找到:Temporarily disable events through the Sitecore API

关于c# - 有没有办法停止 OnItemSaving 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25545593/

相关文章:

sitecore - 浏览 Sitecore 内容树时出现 NullReferenceException

workflow - Sitecore 安全和工作流程

c# - 从 Dictionary 中删除可为 null 的值并重铸类型

c# $ 资源中的字符串

c# - 测试父对象是否存在

c# - 在 View JQuery 中获取 ViewData

c# - 在 Sitecore 中将类作为列表加载

indexing - Sitecore solr索引重建和刷新之间的区别

sitecore - 在 Sitecore 中,如何通过右键单击内容项来打开自定义 Sitecore 应用程序?

c# - 如何以编程方式获取渲染内容?