Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JamesEggers1/6bb33962d37843c182fb9f8b28e004b9 to your computer and use it in GitHub Desktop.
Save JamesEggers1/6bb33962d37843c182fb9f8b28e004b9 to your computer and use it in GitHub Desktop.
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