DbServerSyncProvider.SelectClientIdCommand Property

Synchronization Services - ADO.NET 1.0 SP1

Gets or sets an IDbCommand object that contains the query or stored procedure that returns originator IDs from the server database.

Namespace: Microsoft.Synchronization.Data.Server
Assembly: Microsoft.Synchronization.Data.Server (in microsoft.synchronization.data.server.dll)

public IDbCommand SelectClientIdCommand { get; set; }
/** @property */
public IDbCommand get_SelectClientIdCommand ()

/** @property */
public void set_SelectClientIdCommand (IDbCommand value)

public function get SelectClientIdCommand () : IDbCommand

public function set SelectClientIdCommand (value : IDbCommand)

Property Value

An IDbCommand object that contains a query or stored procedure.

By default, Sync Services identifies each client database with a GUID, which is exposed by the ClientId property. You can also map this GUID to an integer by using the SelectClientIdCommand. The mapped value is exposed by the OriginatorId property. The command is not required, but it can be useful to use an integer to represent a client instead of the GUID that Sync Services uses.

The following code example specifies a command to map a client ID to an originator ID. The command uses a stored procedure on the server database to perform the mapping. To view this code in the context of a complete example, see How to: Use Session Variables.

SqlCommand selectClientIdCommand = new SqlCommand();
selectClientIdCommand.CommandType = CommandType.StoredProcedure;
selectClientIdCommand.CommandText = "usp_GetOriginatorId";
selectClientIdCommand.Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier);
selectClientIdCommand.Parameters.Add("@" + SyncSession.SyncOriginatorId, SqlDbType.Int).Direction = ParameterDirection.Output;
selectClientIdCommand.Connection = serverConn;
this.SelectClientIdCommand = selectClientIdCommand;