Custom Commerce Connect cart and orders entities

Current version: 9.3

If you extend any of the Commerce Server or Commerce Connect types, you can create your own equivalent pipeline processor and insert it after RegisterDataModelExtensions. Do not replace the RegisterDataModelExtensions pipeline.

You must register any entity that is synced into xDB (EAPs or Page Events) in the MongoDbObjectMapper. Inside the Initialize pipeline, there is a processor called RegisterDataModelExtensions that registers all of the Commerce Server extensions to Commerce Connect types.

Example of a pipeline processor that registers a custom type:

RequestResponse
namespace MyNamespace.Pipelines
{    
    using Sitecore.Analytics.Data.DataAccess.MongoDb;
    using Sitecore.Commerce.Connect.CommerceServer.Inventory.Models;
    using Sitecore.Commerce.Connect.CommerceServer.Orders.Models;
    using Sitecore.Pipelines;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    /// <summary>
    /// Pipeline processor that registers data  model extensions with the BSON class map.
    /// </summary>
    public class MyDataModelExtensions
    {
        ///  <summary>
        /// Processes the pipeline arguments. 
       ///  </summary> 
       ///
      <param name="args">The pipeline  arguments.</param>
      public virtual void Process(PipelineArgs  args)
      {           
      MongoDbObjectMapper.Instance.RegisterModelExtension<MyCustomType>();       
      }
   }
}

Do you have some feedback for us?

If you have suggestions for improving this article,