Пользовательский фасет контакта не сохраняется - PullRequest
0 голосов
/ 06 мая 2019

Я использую Sitecore 8.2.И я пытаюсь применить пользовательский аспект в моей контактной информации.Я следую этому руководству: https://doc.sitecore.com/developers/82/sitecore-experience-platform/en/the-merge-contacts-rules.html

но каким-то образом созданный мной нестандартный фасет не индексируется в solr.Я уже пытался имитировать устаревший код и конфиг с sitecore.Но он все еще не работает.

Я попытался использовать нестандартный устаревший фасет из Sitecore для сравнения, он работает.

Есть ли что-то, что я пропустил, чтобы решить эту проблему?

ISubscription.cs

public interface ISubscription: IElement, IValidatable, IFacet
    {
        string SubscriptionIds
        {
            get;
            set;
        }
    }

Subscription.cs

[Serializable]
    internal class Subscription: Facet, ISubscription, IFacet, IElement, IValidatable
    {
        private const string SUBSCRIPTION_IDS = "SubscriptionIds";

        public Subscription()
        {
            base.EnsureAttribute<string>(SUBSCRIPTION_IDS);
        }
        public string SubscriptionIds
        {
            get
            {
                return base.GetAttribute<string>(SUBSCRIPTION_IDS);
            }

            set
            {
                base.SetAttribute<string>(SUBSCRIPTION_IDS, value);
            }
        }
    }

Sitecore.Analytics.Model.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <model>

      <elements>
        ....
        <element interface="MyProject.Custom.Contact.Entities.ISubscription, MyProject.Custom" implementation="MyProject.Custom.Contact.Generated.Subscription, MyProject.Custom"/>
      </elements>

      <entities>
        <contact>
          <factory type="Sitecore.Analytics.Data.ContactFactory, Sitecore.Analytics" singleInstance="true" />
          <template type="Sitecore.Analytics.Data.ContactTemplateFactory, Sitecore.Analytics" singleInstance="true" />
          <facets>
            ....
            <facet name="Subscription" contract="MyProject.Custom.Contact.Entities.ISubscription, MyProject.Custom" />
          </facets>
        </contact>
      </entities>
    </model>

  </sitecore>
</configuration>

Код отладки

//This is indexed
var personal = newContact.GetFacet<Sitecore.Analytics.Model.Entities.IContactPersonalInfo>("Personal");
personal.FirstName = "Jane";
personal.Surname = "Janeth";

//This is indexed
var phone = newContact.GetFacet<Sitecore.Analytics.Model.Entities.IContactAddresses>("Addresses");
phone.Entries.Create("Preferred").StreetLine1 = "St. Berkeley";

//This is not indexed
var subscription = newContact.GetFacet<ISubscription>("Subscription");
subscription.SubscriptionIds = "subscription-to-newsletter";
...