AutomaticContactMerger class
,直到不再包含该类的Kentico 10。API更改参考指南
notes the class as being removed
在Kentico 10中,但不建议使用其合并功能的替代方案或解决方法。
TL;DR摘要
我们正在寻找一种方法来移植我们的联系人管理自定义合并逻辑,并在Kentico运行其默认合并逻辑时将其集成到Kentico 10中,就像我们在Kentico 8中所做的那样,如本文(下文)所示。
注册将参与Kentico 10默认合并流程的自定义合并。
具体来说,我们的项目覆盖了Kentico 8
AutomaticContactMerger
类并提供自定义逻辑,如以下C#所示。NET Kentico 8代码段。
(这段代码已经过简化和消毒,以传达基本场景。)
要理解此代码:
-
我们在Kentico Contact类上有一个自定义字段,名为
EXTERNAL_REFERENCE_VALUE
-
提到K8和K10的源代码注释分别表示Kentico版本8和10。
/* In Kentico 8 we derive from the CMS.OnlineMarketing.AutomaticContactMerger class
to provide custom merge logic
based on custom contact fields and rules ... */
public class CUSTOM_ContactMerger : AutomaticContactMerger /* K10 Removed ACM class */ {
// ==============================================
// In K8 OVERRIDE the default Merge with our custom logic.
protected override ContactInfo MergeWithinSite(ContactInfo contact, List<ContactInfo> contacts, string siteName) {
if (!base.ContactIsMergedByColumn(FieldNames.Contact.EXTERNAL_REFERENCE_VALUE)) {
/* Custom logic determines which contacts will be merged */
var contacts = CUSTOM_GetAllTheContactsIWantToMergeBasedOnCustomRules(..);
/* Find or make a master contact - more custom rules wrapped up */
ContactInfo masterContact = CUSTOM_GetMyPreferredMasterContactOrMakeANewOne();
/* Use Kentico's ContactHelper class to merge all our picked Contacts into the master contact.*/
ContactHelper.Merge(masterContact, contacts, null, null); // however the .Merge methods are gone in K10
return masterContact; // custom selection
// ==============================================
// in K8 OVERRIDE the Where Condition for when merge should be ignored (for example).
protected override string GetWhereCondition(ContactInfo contact) {
if (CUSTOM_ShouldIgnoreMerge(contact)) {
return string.Empty;
}
return base.GetWhereCondition(contact) ?? string.Empty;
}
CMS.OnlineMarketing
命名空间-
-
自动接触合并
类别-从Kentico 10中删除,包括:
-
.MergeWithinSite(..)
虚拟方法被重写
-
.GetWhereCondition(..)
虚拟方法被重写
-
.ContactIsMergedByColumn(..)
-
ContactHelper
向Kentico 8注册自定义合并逻辑
CustomContactMerger
通过提供程序以以下标准方式使用Kentico 8初始化。Kentico 8方法
CMS.OnlineMarketing.ContactInfoProvider.AddAutomaticContactMerger(..)
Kentico 10中也不再存在,因此我们需要一种在Kentico 10中注册自定义合并的方法。Kentico 8将此方法描述为
/// Registers automatic contact merger that gets ran when method SetContactInfo is called.
[assembly: RegisterCustomProvider(typeof(CustomContactInfoProvider))]
public partial class CustomContactInfoProvider : ContactInfoProvider
static CustomContactInfoProvider()
{
var myCustomMerger = new CustomContactMerger(..);
// Note: we do NOT use Kentico's own email settings, because they will be picked up
// by Kentico's private method and give email higher priority (than our own merger logic)
var emailMerger = new CustomContactMerger("ContactEmail", CustomContactMerger.SETTING_MERGE_BY_EMAIL);
var mergers = new List<CustomContactMerger>() { merger, emailMerger };
foreach (var m in mergers)
{
// Kentico 8 registration point. Kentico 10 does not have this method call.
base.AddAutomaticContactMerger(m);
}
Kentico 10关于核心产品中联系人管理变化的发行说明,因为它与CMS桌面功能有关:
默认情况下,系统仅自动合并联系人,这
导致以下变化:
-
不再可能合并
应用
-
在联系人管理应用程序中拆分合并的联系人。
-
无法再克隆克隆帐户中的合并帐户
对话框和“克隆联系人”对话框中的合并联系人。
-
这个
自动将联系人设置类别与以下内容合并
已从设置中删除设置->在线营销->联系
管理->全球数据和;合并:
~
https://docs.kentico.com/k10/release-notes-kentico-10#Releasenotes-Kentico10-Contactmanagement