COM Custom Resolvers

SQL Replication

Replication

COM Custom Resolvers

A COM custom conflict resolver is a dynamic-link library (DLL) that implements the ICustomResolver interface, its methods and properties, and other supporting interfaces and type definitions designed specially for conflict resolution.

These interfaces and type definitions are defined in Microsoft® Visual C++® header files (Sqlres.h and Sqlresid.h), supplied with the merge conflict resolver samples in \Microsoft SQL Server\Tools\DevTools\Samples\Sqlrepl (available through a custom installation of Microsoft SQL Server™ 2000). If you are a Visual C++ developer, you can view these samples to get an idea of how to build a custom COM resolver in Visual C++.

Because the conflict resolver interfaces are COM-based and therefore language-neutral, it is possible to create custom COM resolvers in other languages than C++. To build a custom COM resolver in Visual Basic®, you can use the type library that is provided in the replrec.dll.

Before writing a custom COM resolver, you need to decide:

  • The types of row changes you want to resolve, such as updates, inserts, and deletes, and for the upload of merge changes, the download, or both. You can specify one type of change, all changes, or any combination. The default merge conflict resolver handles any conflicts not covered by a custom resolver.

  • Whether to use column tracking when resolving the conflict. No column tracking means that changes are tracked at the row level. Changes to any columns in both rows are flagged as a conflict. To resolve the conflict, the priority winner overwrites the entire row of data.

When column-level tracking is on, only data in those columns where a conflict exists are flagged as a conflict, otherwise the data is merged. However, conflicts are resolved in the same way as row-level tracking: the priority winner overwrites the entire row of data (but the data can be a mix of values from the Publisher, Subscribers, or some altered values that were from neither Publisher nor Subscribers).

When using a custom COM resolver with merge replication on a cluster, you must register the custom resolver on both nodes of the cluster regardless of whether the configuration is active-active or active-passive. This is required to ensure that the custom resolver will be able to properly load the reconcile following a failover.