internal Contact GetContactByOptions(Guid contactId, ExpandOptions options = null) { using (XConnectClient client = SitecoreXConnectClientConfiguration.GetClient("xconnect/clientconfig")) { if (options == null) { options = (ExpandOptions) new ContactExpandOptions(Array.Empty <string>()) { Interactions = new RelatedInteractionsExpandOptions(new string[1] { "IpInfo" }) } } ; ContactReference contactReference = new ContactReference(contactId); Contact contact = XConnectSynchronousExtensions.Get <Contact>((IXdbContext)client, (IEntityReference <Contact>)contactReference, options); if (contact == null) { throw new ContactNotFoundException(string.Format("No Contact with id [{0}] found", (object)contactId)); } return(contact); } } }
public override ActivityResult Invoke(IContactProcessingContext context) { if (this.BehaviorProfileValues != null) { if (Enumerable.Any <BehaviorProfileValue>((IEnumerable <BehaviorProfileValue>) this.BehaviorProfileValues)) { try { CollectionModel.SetProfileScores(this.Services.Collection, this.CreateInteraction(context), this.GetProfileScores(context)); XConnectSynchronousExtensions.Submit(this.Services.Collection); //LoggerExtensions.LogDebug((ILogger)this.Logger, string.Format((IFormatProvider)CultureInfo.InvariantCulture, Resources.TheFacetHasBeenSetAndSubmittedSuccessfullyPattern, (object)"ContactBehaviorProfile"), Array.Empty<object>()); return((ActivityResult) new SuccessMove()); } catch (Exception ex) when(ex is FacetOperationException || ex is ArgumentNullException || ex is InvalidOperationException) { //LoggerExtensions.LogError((ILogger)this.Logger, (EventId)0, ex, string.Format((IFormatProvider)CultureInfo.InvariantCulture, Resources.TheFacetHasNotBeenSetAndSubmittedSuccessfullyPattern, (object)"ContactBehaviorProfile"), Array.Empty<object>()); return((ActivityResult) new Failure(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Resources.TheFacetHasNotBeenSetAndSubmittedSuccessfullyPattern, (object)"ContactBehaviorProfile"))); } } } Log.Debug(string.Format((IFormatProvider)CultureInfo.InvariantCulture, Resources.TheActivityPropertyHasNotBeenSetPattern, (object)"BehaviorProfileValues"), Array.Empty <object>()); return((ActivityResult) new Failure(string.Format((IFormatProvider)CultureInfo.CurrentCulture, Resources.TheActivityPropertyHasNotBeenSetPattern, (object)"BehaviorProfileValues"))); }