Connector Factory Class

A connector factory class initializes a connector that has the specified type and name.

Base Class and Interface

The connector factory class implements the PX.Commerce.Core.IConnectorFactory interface and optionally derives from the PX.Commerce.Core.BaseConnectorFactory<GraphType> base abstract class, which provides the default implementation of particular methods of the interface.

Members of the Class

In the connector factory class, you specify the type of the connector in the Type property and the name of the connector in the Description property. These are the type and name that are defined in the ConnectorType and ConnectorName properties of the connector class.

You also define the condition when the connector is available in MYOB Acumatica in the Enabled property. For example, the connector can be available if a particular feature is enabled on the Enable/Disable Features (CS100000) form.

If your connector factory class derives from the BaseConnectorFactory<GraphType>, you need to implement only the following items: a constructor of the factory class, and the GenerateExternID() and GenerateLocalID() methods.

Example

An example of the implementation of a connector factory class is shown in the following code.

Tip:
You can see this code on GitHub.
using PX.Commerce.Core;
using System;

namespace WooCommerceTest
{
    public class WooCommerceConnectorFactory : BaseConnectorFactory<WooCommerceConnector>, IConnectorFactory
    {
        public override string Description => WooCommerceConnector.NAME;
        public override bool Enabled => true;

        public override string Type => WooCommerceConnector.TYPE;

        public WooCommerceConnectorFactory(ProcessorFactory factory)
            : base(factory)
        {
        }

        public virtual Guid? GenerateExternID(BCExternNotification message)
        {
            throw new NotImplementedException();
        }
    }
}