Table of Contents

Class ConflictResolutionPolicy

Namespace
Microsoft.Azure.Cosmos
Assembly
Microsoft.Azure.Cosmos.Client.dll

Represents the conflict resolution policy configuration for specifying how to resolve conflicts in case writes from different regions result in conflicts on items in the container in the Azure Cosmos DB service.

public class ConflictResolutionPolicy
Inheritance
ConflictResolutionPolicy
Inherited Members
Extension Methods

Constructors

ConflictResolutionPolicy()

Initializes a new instance of the ConflictResolutionPolicy class for the Azure Cosmos DB service.

public ConflictResolutionPolicy()

Properties

Mode

Gets or sets the ConflictResolutionMode in the Azure Cosmos DB service. By default it is LastWriterWins.

public ConflictResolutionMode Mode { get; set; }

Property Value

ConflictResolutionMode

One of the values of the ConflictResolutionMode enumeration.

ResolutionPath

Gets or sets the path which is present in each item in the Azure Cosmos DB service for last writer wins conflict-resolution. This path must be present in each item and must be an integer value. In case of a conflict occurring on a item, the item with the higher integer value in the specified path will be picked. If the path is unspecified, by default the time stamp path will be used.

public string ResolutionPath { get; set; }

Property Value

string

The path to check values for last-writer wins conflict resolution. That path is a rooted path of the property in the item, such as "/name/first".

Examples

conflictResolutionPolicy.ConflictResolutionPath = "/name/first";

Remarks

This value should only be set when using LastWriterWins

ResolutionProcedure

Gets or sets the StoredProcedureProperties which is used for conflict resolution in the Azure Cosmos DB service. This stored procedure may be created after the Container is created and can be changed as required.

public string ResolutionProcedure { get; set; }

Property Value

string

The stored procedure to perform conflict resolution.

Examples

conflictResolutionPolicy.ConflictResolutionProcedure = "dbs/databaseName/colls/containerName/sprocs/storedProcedureName";

Remarks

  1. This value should only be set when using Custom
  2. In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed"/>.
  3. The user can provide the stored procedure id.