DbServerSyncProvider::SelectClientIdCommand Property
Gets or sets an IDbCommand object that contains the query or stored procedure that returns originator IDs from the server database.
Assembly: Microsoft.Synchronization.Data.Server (in Microsoft.Synchronization.Data.Server.dll)
public: property IDbCommand^ SelectClientIdCommand { IDbCommand^ get (); void set (IDbCommand^ value); }
Property Value
Type: System.Data::IDbCommandAn IDbCommand object that contains a query or stored procedure.
By default, Sync Framework 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 Framework 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;
Dim selectClientIdCommand As New SqlCommand() With selectClientIdCommand .CommandType = CommandType.StoredProcedure .CommandText = "usp_GetOriginatorId" .Parameters.Add("@" + SyncSession.SyncClientId, SqlDbType.UniqueIdentifier) .Parameters.Add("@" + SyncSession.SyncOriginatorId, SqlDbType.Int).Direction = ParameterDirection.Output .Connection = serverConn End With Me.SelectClientIdCommand = selectClientIdCommand