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

Kentico - Excluding a specific Custom Table from staging data tasks

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

我确实有其他自定义 table,但我想继续记录暂存任务。

如何排除特定的自定义 table?我可以看到示例: https://docs.kentico.com/k10/custom-development/handling-global-events/excluding-content-from-staging-and-integration

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

到目前为止我找到的所有样本都是针对 users/roles 的,它们是开箱即用的对象类型。

为有问题的自定义 table 的日志更改事件创建一个全局处理程序。使用这样的东西:

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;
        }
    }
}

我发现这个博客 post 很有用,https://www.bluemodus.com/blog/october-2016/kentico-tip-how-to-create-a-staging-filter-module