Kentico-从暂存数据任务中排除特定的自定义表

Kentico-从暂存数据任务中排除特定的自定义表,kentico,Kentico,我正在向我的Kentico 10网站添加一个新的自定义表。我希望同步任何自定义表结构更改,但不希望在不同环境之间同步数据 不过,我确实有其他自定义表,我希望为它们记录登台任务 如何为特定的自定义表排除?我可以看到样本: 但是我不知道我可以在synchronizedObject上使用什么属性来验证它是否与自定义表相关 到目前为止,我找到的所有示例都是针对开箱即用对象类型的用户/角色的。为相关自定义表的日志更改事件创建一个全局处理程序。使用类似以下内容: using CMS; using CMS.

我正在向我的Kentico 10网站添加一个新的自定义表。我希望同步任何自定义表结构更改,但不希望在不同环境之间同步数据

不过,我确实有其他自定义表,我希望为它们记录登台任务

如何为特定的自定义表排除?我可以看到样本:

但是我不知道我可以在synchronizedObject上使用什么属性来验证它是否与自定义表相关


到目前为止,我找到的所有示例都是针对开箱即用对象类型的用户/角色的。

为相关自定义表的日志更改事件创建一个全局处理程序。使用类似以下内容:

using CMS;
using CMS.DataEngine;

// Registers the custom module into the system
[assembly: RegisterModule(typeof(CustomHandlerModule))]

public class CustomHandlerModule : Module
{
    // Module class constructor, the system registers the module under the name "LogChangeHandlers"
    public CustomHandlerModule()
        : base("CustomHandlerModule") { }

    // Contains initialization code that is executed when the application starts
    protected override void OnInit()
    {
        base.OnInit();
        ObjectEvents.LogChange.Before += LogChange_Before;
    }

    private void LogChange_Before(object sender, LogObjectChangeEventArgs e)
    {
        // check the type info for your specific custom table type/item.  
        // Could use a switch statement here too if you have multiple
        // make sure to update "namespace" and "classname" with your custom data.  
        // Do not modify the "customtableitem" string, that is needed.
        if (e.Settings.InfoObj.TypeInfo.ObjectType.ToLower() == "customtableitem.namespace.classname")
        {
            e.Settings.LogStaging = false;
        }
    }
}

为相关自定义表的日志更改事件创建全局处理程序。使用类似以下内容:

using CMS;
using CMS.DataEngine;

// Registers the custom module into the system
[assembly: RegisterModule(typeof(CustomHandlerModule))]

public class CustomHandlerModule : Module
{
    // Module class constructor, the system registers the module under the name "LogChangeHandlers"
    public CustomHandlerModule()
        : base("CustomHandlerModule") { }

    // Contains initialization code that is executed when the application starts
    protected override void OnInit()
    {
        base.OnInit();
        ObjectEvents.LogChange.Before += LogChange_Before;
    }

    private void LogChange_Before(object sender, LogObjectChangeEventArgs e)
    {
        // check the type info for your specific custom table type/item.  
        // Could use a switch statement here too if you have multiple
        // make sure to update "namespace" and "classname" with your custom data.  
        // Do not modify the "customtableitem" string, that is needed.
        if (e.Settings.InfoObj.TypeInfo.ObjectType.ToLower() == "customtableitem.namespace.classname")
        {
            e.Settings.LogStaging = false;
        }
    }
}

我发现这篇博文非常有用,

我发现这篇博文非常有用,

非常感谢我所需要的。我注意到我们目前有一个StagingEvents.LogTask.Before的全局处理程序-您知道这与LogChange有何不同吗?记录对象任务时会触发
LogChange
事件。您可以禁用登台、集成等任务的日志记录。登台记录任务时,源服务器上会触发事件。也就是说,LogChange事件在StagingEvents触发之前触发,这意味着如果您在LogChange事件处理程序中执行签入操作,就会少触发一个事件。我注意到我们目前有一个StagingEvents.LogTask.Before的全局处理程序-您知道这与LogChange有何不同吗?记录对象任务时会触发
LogChange
事件。您可以禁用登台、集成等任务的日志记录。登台记录任务时,源服务器上会触发事件。也就是说,LogChange事件在StagingEvents触发之前触发,这意味着如果您在LogChange事件处理程序中执行签入操作,则会少触发一个事件。