DbServerSyncProvider.SelectClientIdCommand Property
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)
Syntax
'Declaration
Public Property SelectClientIdCommand As IDbCommand
Get
Set
'Usage
Dim instance As DbServerSyncProvider
Dim value As IDbCommand
value = instance.SelectClientIdCommand
instance.SelectClientIdCommand = value
public IDbCommand SelectClientIdCommand { get; set; }
public:
property IDbCommand^ SelectClientIdCommand {
IDbCommand^ get ();
void set (IDbCommand^ value);
}
member SelectClientIdCommand : IDbCommand with get, set
function get SelectClientIdCommand () : IDbCommand
function set SelectClientIdCommand (value : IDbCommand)
Property Value
Type: System.Data.IDbCommand
An IDbCommand object that contains a query or stored procedure.
Remarks
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.
Examples
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