Share via


ISaveChangeWithChangeUnitsContext2::SetConstraintConflictOnChangeUnit

Reports that a constraint conflict occurred when the destination provider tried to apply the change to the destination replica, for a change that contains change units.

Syntax

HRESULT SetConstraintConflictOnChangeUnit(
  ISyncChangeUnit * pChangeUnit);

Parameters

  • pChangeUnit
    [in] The change unit on the destination replica that conflicts with the change unit to be applied.

Return Value

  • S_OK.

  • E_INVALIDARG when pChangeUnit is not found in the change to be applied.

  • E_POINTER.

  • SYNC_E_INVALID_OPERATION if a constraint conflict or recoverable error has already been set on this object.

Remarks

A constraint conflict occurs when a destination provider tries to apply a change to the destination replica, and the change violates a constraint of the destination replica. For change units, this typically means that the change violates some business logic on the destination replica. As an example of a business logic conflict, consider a low-fidelity replica that stores two change units: name and country. Also consider a high-fidelity replica that stores three change units: name, state/province, and country. The high-fidelity replica contains business logic that checks the state/province field against the country field, and will not store a change that does not pass the check. The low-fidelity replica acts as the source and sends an item with country set to "USA". The destination provider attempts to apply the change to the high-fidelity replica, but on the high-fidelity replica the item contains "British Columbia" in its state/province field. Therefore, the change violates the business logic and causes a constraint conflict on the change unit that represents the state/province field.

When the destination provider uses this method to report a constraint conflict, the change applier resolves the conflict according to the conflict resolution action set by the application for the specified conflict. The change applier then dispatches any necessary calls to the destination provider so that the destination provider can apply the resolved conflict to the destination replica. For more information, see Detecting and Resolving Constraint Conflicts.

See Also

Reference

ISaveChangeWithChangeUnitsContext2 Interface