Extending xDB by creating a custom contact facet
In xDB, you can store custom contact information using
System facets such as
Extensions. However, to store complex information such as dictionaries or collections, you can extend the
Contact with your custom facet. In this recipe, you will learn how to store shopping cart information to the
Contacts collection in xDB.
For this recipe, you should create product pages with an Add to cart button on it.
How to do it…
We will first create a
Contract to define the structure of elements of the facet:
- In the
SitecoreCookbookproject, create an
IShoppingCartRecordinterface in the
Modelsubfolder in the
Analyticsfolder that extends the
IValidatableinterfaces as follows: