Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sitecore 8.x Custom Facet Interface and Implementation
using Sitecore.Analytics.Model.Framework;
using System;
namespace MyNamespace.Facets
{
public interface ICustomerPaymentFacet : IFacet
{
decimal LastPaymentAmount { get; set; }
DateTime LastPaymentDate { get; set; }
}
[Serializable]
public class CustomerPaymentFacet : Facet, ICustomerPaymentFacet
{
public CustomerPaymentFacet()
{
EnsureAttribute<decimal>(nameof(LastPaymentAmount));
EnsureAttribute<DateTime>(nameof(LastPaymentDate));
}
public decimal LastPaymentAmount { get => GetAttribute<string>(nameof(LastPaymentAmount)); set => SetAttribute(nameof(LastPaymentAmount), value); }
public DateTime LastPaymentDate { get => GetAttribute<string>(nameof(LastPaymentDate)); set => SetAttribute(nameof(LastPaymentDate), value); }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.