将相关页面添加到文档时发生的事件

问题描述:

除了LogChange之外,在向文档添加/删除相关页面时会发生更具体的事件吗?将相关页面添加到文档时发生的事件

我希望能够从缓存中删除页面时发生这种情况

您是否尝试过使用由CMS.DocumentEngine.RelationshipInfo.TYPEINFO.Events属性定义的全局事件?例如:

public class CustomRelationshipEvents : CMSLoaderAttribute 
{ 
    public override void Init() 
    { 
     RelationshipInfo.TYPEINFO.Events.Insert.After += Insert_After; 
    } 

    private void Insert_After(object sender, ObjectEventArgs e) 
    { 
     // Clear cache here 
    } 
} 

CustomRelationshipEvents属性然后添加到Kentico的CMSModuleLoader类的扩展......

+0

感谢。正是我想要的, – RadarBug

+0

太棒了,请标记为已接受的答案。 – getsetcode

+0

@RadarBug你也可以在文档中找到这些精确的代码示例。 https://docs.kentico.com/api10和https://docs.kentico.com/k10/custom-development/handling-global-events –