Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Extending the replication synchronization process

Developers might want to extend the core replica behavior during synchronization. The synchronization process can be extended by implementing a workspace extension that supports IWorkspaceReplicaSyncEvents. By implementing this interface in an extension, custom behavior can be executed before and after any replica synchronization process executed on a geodatabase.
  • This sample describes the process using the example of a developer wanting to copy new raster datasets from a raster catalog during the synchronization. In this example, when synchronization is executed, the extension identifies and copies the new raster datasets from the source geodatabase to the target geodatabase.

  • This sample is for connected synchronization where connections are made to local geodatabases.

  • This sample can be used as a reference for developers needing to extend synchronization for any reason.

Language:              C#, VB
Subject:               Geodatabase
Organization:          Esri,
Date:                  11/17/2017
ArcObjects SDK:        10.6
Visual Studio:         2015, 2017
.NET Target Framework: 4.5



Preparing the data

  1. This sample requires that the raster catalog has a long integer column named "gen." If the replica has been created and has that column, proceed with Step 7 in this section.
  2. Open the parent raster catalog to be synchronized in ArcMap.
  3. Add the gen column to the raster catalog using the Add Field option in the attribute table.
  4. Set the value of the gen column for any existing raster datasets in the raster catalog to 0. The field calculator can be used to do this quickly.
  5. Repeat Steps 2-4 for the child raster catalog.
  6. Create a replica of the raster catalog. For more information, see "How to create a replica in a connected environment" in the See Also section in this topic. The creation process copies the raster catalog and the raster datasets that intersect the replica geometry by default. To create the replica, at least one versioned feature class with edit permission must also be included in the replica. It is not possible to create a replica consisting only of the raster dataset.
  7. Once the replica exists, make sure that the raster catalog exists in the parent and the child replica geodatabases, and that each has a long integer column named gen.
  8. If there are common raster datasets, set the value in the gen column to 0 for the common datasets in the parent and child replica geodatabases.

Building the extension

  1. Once the data is prepared, build the extension and register it with the replica geodatabases by completing the following steps.
  2. Copy the solution locally and open the solution.
  3. Open the RasterSyncWorkspaceExtension.cs (if working in C#) or RasterSyncWorkspaceExtension.vb (if working in VB .NET) source file.
  4. There are two member variables in the extension that can be adjusted. The rasterCatalog variable (a private constant string, currently set to "ras_cat") is the name of the raster catalog to involve in the synchronization. By changing this value before building the assembly, the synchronized raster catalog can be changed.
  5. The other variable is the replica variable (a private constant string, currently set to "myreplicaras"), which is the name of the replica whose synchronization event triggers this behavior. By changing this value before building the assembly, the replica with extended behavior can be changed.
  6. Right-click the project and choose build. This creates the assembly in the project's debug or release directory (depending on the selected option).

Applying the extension to one or more geodatabases

  1. Which geodatabase or geodatabases require the workspace extension depends on the type of replica being used. For one-way parent-to-child replication, both geodatabases involved with the replica requires the extension. For two-way replication, both geodatabases involved with the replica requires the extension. The RasterSynchExtensionReg* project compiles to an executable that registers the workspace extension with a geodatabase.
  2. Right-click the RasterSyncExtensionReg* project and choose Set as StartUp Project.
  3. Open RegisterExtension.cs.
  4. Change the RegisterExtension.workspacePath value to the path of an ArcSDE connection file or local geodatabase that has the extension applied to it.
  5. Change the RegisterExtension.geodatabaseType value to reflect the type of geodatabase on which the extension is being registered.
  6. Right-click the project and choose build.
  7. Press F5 to run the project.
  8. Steps 2-7 in this section registers the extension with one of the replica geodatabases. If two-way replication is being used, repeat these steps for the other replica geodatabase. Once this is completed, synchronizing the replica identified in the previous steps executes the extension.

Using the extension

  1. Synchronizing the replica associated with the extension using the wizards, or the geoprocessing tools in ArcCatalog or ArcMap, triggers the extension's behavior. To test this, assuming that a two-way replica is being used, complete the following steps.
  2. Load one or more new raster datasets into the raster catalog in the parent geodatabase. When this is done, the gen column has a null value for the new raster datasets.
  3. In the same way, load one or more new raster datasets into the raster catalog in the child.
  4. In ArcCatalog, connect to the parent replica geodatabase and synchronize from the parent to the child. Notice that a value is assigned to the gen column of the new raster datasets. This is the generation number of the synchronization in which the raster datasets were sent.
  5. In ArcCatalog, connect to the child replica geodatabase and preview the raster catalog. Notice that the raster datasets from the parent have been applied and have a gen value of –1. The –1 value indicates that these have been received from the parent.
  6. In ArcCatalog, synchronize from the child to the parent. Notice that the raster datasets that were added to the child in Step 3 were applied to the parent and the values in the gen column for these datasets were adjusted.
  7. As raster datasets are added and synchronized, the parent and child are kept up to date with the new raster datasets. The extension also supports cases where (for any reason) synchronization fails. Here, the generation information in the gen column is used to determine if rasters need to be resent.

Additional information

The main goal of the sample is to show how to extend replica synchronization. There are a number of enhancements that can be added to support your specific requirements. Some of these include the following:

See Also

How to create a replica in a connected environment


Development licensing Deployment licensing
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
Engine Developer Kit Engine: Geodatabase Update
You can’t perform that action at this time.