Step 5: Creating the Buckets for the Mapped Entities

For each mapping class, you need to create a bucket class. For details about bucket classes, see Bucket Classes.

Defining the Buckets for the Mapped Entities

  1. For each mapping class, in the Visual Studio project of the extension library, create a bucket class that derives from the PX.Commerce.Core.IEntityBucket interface and, optionally, the PX.Commerce.Core.EntityBucketBase class. In this example, you are creating the WooCustomerEntityBucket class.
  2. In this class, define the entity that is being synchronized in the Primary property of the bucket class and all entities that are being synchronized in this bucket in the Entities property. The following code shows an example of the implementation.
    Tip:
    You can see this code on GitHub.
    using PX.Commerce.Core;
    
    namespace WooCommerceTest
    {
        public class WooCustomerEntityBucket : EntityBucketBase, IEntityBucket
        {
            public IMappedEntity Primary => Customer;
            public IMappedEntity[] Entities => new IMappedEntity[] { Customer };
    
            public MappedCustomer Customer;
        }
    }
  3. Build the project.