Data Management (Import and Export)

Xafari.Data module is intended for data exchange between a XAF application and external systems. This module provides both versatile tools for a wide range of custom tasks, and a number of certain components approved by real-world applications.

The module allows to implement data migration due to the following scenarios:

  • Integration of the XAF application with external systems
  • Initial import of data when running the system in operation
  • Data migration when upgrading version of the system
  • Data synchronization between multiple systems by scheduled or event

The manipulations to be performed with data are declared by the IOperation interface. Operation interacts with external source. This is a complex multi-stage process that performs a holistic and consistent update of data. To be executed the operation requires to describe data source (IDataSource) and to determine various settings (ISettings). IDataSource represents the data store of the external system, i.e. the source to which the operation will have access. ISettings describes the settings of the operation, in particular it is a schema of the data mapping.

The module describes the architecture of the solution and contains components that support all current scenarios of our customers. If this is not enough, the developer can implement its own specific components.


Xafari supplies two implementations of the IOperation interface, these are ImportOperation and ExportOperation that ensure the migration of data in the corresponding directions. To support these operations, the following classes are used:

There are a lot of events which allow you to customize all stages of the process. A rich and flexible logging system provides monitoring of all steps.

Thus, when using ExportOperation and ImportOperation from Xafari, it remains only to select or implement a suitable data source.

To read or write data from an external system, the operation apply to the data source. Its responsibility is to take into account all the specifics of these data and to provide transparent access to the tables, columns, rows, etc. There are four data sources in Xafari.Data.dll that are fully compatible with ExportOperation and ImportOperation, they are listed below:

The aforesaid sources can be used as an example to implement your custom specific.

If there is a suitable data source, then the only thing you need is to configure the import (export)settings. The settings describe in detail the data model and data migration parameters, it is declared by the ISettings interface. The setting object may be represented in a serialized form. Xafari.Data provides a rich set of keys to specify the various options of data processing. As a rule, the main time to deploy the import or export is to set settings properly.

Settings define the tables to be processed and the order of operations on them. It sets a correspondence between the tables and columns of the data source, on the one hand, and the persistent types and fields of the data model on another one. The keys MemberName, MemberTypeName, ColumnName, ColumnTypeName and other ensure this correspondence. Settings allow to set filters using expressions, to index import or export processes, to choose different ways of handling exceptions. There are even more other parameters.

To get the primary representation about the subject, please refer to the Getting Started topic.