# Plugin Registration Setup

To use the plugin synchronization part of DAXIF#, you need to use this extended Plugin.cs, instead of the regular one (remember to change the namespace to match your project).

The standard way of registering a plugin looks similar to the following:

// Standard method:
40, // Post-operation
"Update",
Account.LogicalName,
new Action<LocalPluginContext>(ExecuteAccountStuff)));

We have introduced a method for registering plugin steps. This new method is a more robust, more versatile and more configurable way of setting up the plugin step in your code with the use of specific enums and classes.

The above registration of a plugin step should be replaced by the new function:

// New Delegate A/S method:
RegisterPluginStep<Account>(EventOperation.Update, ExecutionStage.PostOperation, ExecuteAccountStuff)

The main function here is RegisterPluginStep, which takes an entity type as a generic type parameter. It also takes the necessary other parameters, which is the operation (from the EventOperation enum), the execution stage (from the ExecutionStage enum), and the desired function to be used.

What's more with this function, is that it returns an object, which can be used to further configure settings such as the method of deployment, asynchronous/synchronous, execution order, filtering attributes and even adding images!

Here is an example of a plugin step with a bunch of configurations:

// New Delegate A/S method:
RegisterPluginStep<Account>(EventOperation.Update, ExecutionStage.PostOperation, ExecuteAccountStuff)
.SetDeployment(Deployment.ServerOnly)
.SetExecutionMode(ExecutionMode.Asynchronous)
.AddImage(ImageType.PreImage, x => x.Address1_Country);
Note: To register a step on all entites (i.e. for Associate/Dissassociate) you need to use the class AnyEntity as a generic type parameter for the function.