Bucket Classes

For the synchronization of data between an external system and MYOB Advanced, for each entity that you need to synchronize, you need to define a bucket class that defines the entities to be synchronized before and after the synchronization of this entity.

Base Class and Interface

You define this bucket in the bucket class, which derives from the PX.Commerce.Core.IEntityBucket interface and, optionally, the PX.Commerce.Core.EntityBucketBase base class. The EntityBucketBase class is a supplementary class that provides the default implementation of the PreProcessors and PostProcessors properties of the IEntityBucket interface.

In the bucket class, you need to define the entity that is being synchronized in the Primary property of the bucket class. In the Entities property of the bucket class, you specify all entities that are being synchronized in this bucket. The PreProcessors property contains the list of entities that should be synchronized before the entity is, while the PostProcessors property specifies the list of entities that should be synchronized after the entity is.

Example

Suppose that after the synchronization of address entities between an external system and MYOB Advanced, you need to synchronize customer entities. The following code shows an example of the bucket class implementation for the address and customer entities.

public class BCLocationEntityBucket : EntityBucketBase, IEntityBucket
{
  public IMappedEntity Primary => Address;
  public IMappedEntity[] Entities => 
    new IMappedEntity[] { Address, Customer };

  public override IMappedEntity[] PostProcessors => 
    new IMappedEntity[] { Customer };

  public MappedLocation Address;
  public MappedCustomer Customer;
}