Sitecore 8.x Custom Facet Interface and Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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