Export Import

← Back Merge settings

Description

Merge settings define which tables/fields are included in data exchange

You have full control over which data you want to synchronize: you can toggle on add/delete/update operations and choose which tables/fields you wish to update.

Here is how it works: Every synchronization has a source and a destination. If you are exporting data from BDDatabase to, let's say, Excel file - the source is BGDatabase and a destination- is Excel file. Here is how data is classified during syncing:

So, there are 3 types of rows during syncing:

  1. Matching rows : they exist in the Source and in the Destination. Can be updated, and you can choose which fields to update.
  2. Missing rows : they exist only in the Source. Can be added to Destination.
  3. Orphaned rows : they exist only in the Destination. Can be removed from Destination.

Let's look at merge settings and find out how we can define actions to take during syncing

Row-level control for merge settings

Merge settings let you configure which table/fields you want to add/delete/update, but it does not give you the opportunity to define which rows you want to add/delete/update

For row-level control, you can implement C# controller class, which can cancel any operation if some condition is met. This is how:

  • Create your own C# class with unique name, set this class name to "Controller Type" field of merge settings (using the full name with namespace).
  • Implement any number of interfaces (namespace is BansheeGz.BGDatabase, interfaces defined inside class BGMergeSettingsEntity), listed below to receive callback method invocations. Return true from these methods to cancel operation
Interface type method(s) to implement description
IMergeReceiver public bool OnBeforeMerge(BGRepo from, BGRepo to)
public void OnAfterMerge(BGRepo @from, BGRepo to)
Callbacks to be called before after merging. Return true from OnBeforeMerge to cancel merging
IRemoveOrphanedReceiver public bool OnBeforeDelete(BGEntity toEntity) Callbacks to be called before deleting the row. Return true to cancel removal.
IAddMissingReceiver public bool OnBeforeAdd(BGEntity fromEntity) Callbacks to be called before adding the row. Return true to cancel adding.
IUpdateMatchingReceiver public bool OnBeforeUpdate(BGEntity @from, BGEntity to) Callbacks to be called before updating the row. Return true to cancel updating.
IUpdateMatchingFieldReceiver public bool OnBeforeFieldUpdate(BGField fromField, BGField toField, BGEntity @from, BGEntity to) Callbacks to be called before updating the row' field. The same as IUpdateMatchingReceiver, but it's called on per field basis. IUpdateMatchingReceiver is called before this callback, and if IUpdateMatchingReceiver return true, this callback will never be invoked (cause updating entity will be cancelled by IUpdateMatchingReceiver)
ISaveLoadAddonSavedEntityFilter bool OnSaveEntity(BGEntity entity) Callback is called by SaveLoad addon while saving the data for each row. If this method returns true, the row is skipped and not included into saved data

You can find an example of such controller class on Save/Load addon page.

← Back to Export Import