Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Ottiene o imposta le dimensioni dei batch (espressa in righe) utilizzate dai comandi che recuperano le modifiche dal database server.
Spazio dei nomi: Microsoft.Synchronization.Data.Server
Assembly: Microsoft.Synchronization.Data.Server (in microsoft.synchronization.data.server.dll)
Sintassi
'Dichiarazione
Public Property BatchSize As Integer
'Utilizzo
Dim instance As DbServerSyncProvider
Dim value As Integer
value = instance.BatchSize
instance.BatchSize = value
public int BatchSize { get; set; }
public:
property int BatchSize {
int get ();
void set (int value);
}
/** @property */
public int get_BatchSize ()
/** @property */
public void set_BatchSize (int value)
public function get BatchSize () : int
public function set BatchSize (value : int)
Valore proprietà
Dimensione dei batch (espressa in righe) utilizzata dai comandi che recuperano le modifiche dal database server.
Osservazioni
Sync Framework consente alle applicazioni di scaricare batch di modifiche nel client. La divisione in batch non è supportata per il caricamento. Per abilitare la divisione in batch, è necessario specificare un valore per la proprietà BatchSize e creare un comando per la proprietà SelectNewAnchorCommand in grado di restituire valori non ricorsivi per ciascun batch di modifiche. Per ulteriori informazioni, vedere Procedura: specificare l'ordine e la dimensione dei batch di modifiche.
Esempio
Nell'esempio di codice seguente viene creato un comando di ancoraggio che è possibile utilizzare se le modifiche vengono inviate in batch. In questo caso viene restituito un nuovo valore di ancoraggio per ogni batch di modifiche, anziché un unico valore per l'intero set di modifiche. Vengono utilizzate la proprietà BatchSize per specificare il numero di modifiche da includere in ogni batch e le variabili di sessione per trasferire i valori di ancoraggio tra una stored procedure e il runtime di sincronizzazione. Se i comandi dell'adattatore di sincronizzazione vengono scritti manualmente, vengono comunque utilizzate le variabili di sessione @sync_new_received_anchor e @sync_last_received_anchor. La variabile di sessione @sync_max_received_anchor viene utilizzata solo dal comando di nuovo ancoraggio. Per visualizzare questo codice nel contesto di un esempio completo, vedere Procedura: specificare l'ordine e la dimensione dei batch di modifiche.
SqlCommand selectNewAnchorCommand = new SqlCommand();
selectNewAnchorCommand.Connection = serverConn;
selectNewAnchorCommand.CommandText = "usp_GetNewBatchAnchor";
selectNewAnchorCommand.CommandType = CommandType.StoredProcedure;
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.Timestamp, 8);
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncMaxReceivedAnchor, SqlDbType.Timestamp, 8);
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.Timestamp, 8);
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncBatchSize, SqlDbType.Int, 4);
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncBatchCount, SqlDbType.Int, 4);
selectNewAnchorCommand.Parameters["@" + SyncSession.SyncMaxReceivedAnchor].Direction = ParameterDirection.Output;
selectNewAnchorCommand.Parameters["@" + SyncSession.SyncNewReceivedAnchor].Direction = ParameterDirection.Output;
selectNewAnchorCommand.Parameters["@" + SyncSession.SyncBatchCount].Direction = ParameterDirection.InputOutput;
this.SelectNewAnchorCommand = selectNewAnchorCommand;
this.BatchSize = 50;
Dim selectNewAnchorCommand As New SqlCommand()
selectNewAnchorCommand.Connection = serverConn
selectNewAnchorCommand.CommandText = "usp_GetNewBatchAnchor"
selectNewAnchorCommand.CommandType = CommandType.StoredProcedure
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.Timestamp, 8)
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncMaxReceivedAnchor, SqlDbType.Timestamp, 8)
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.Timestamp, 8)
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncBatchSize, SqlDbType.Int, 4)
selectNewAnchorCommand.Parameters.Add("@" + SyncSession.SyncBatchCount, SqlDbType.Int, 4)
selectNewAnchorCommand.Parameters("@" + SyncSession.SyncMaxReceivedAnchor).Direction = ParameterDirection.Output
selectNewAnchorCommand.Parameters("@" + SyncSession.SyncNewReceivedAnchor).Direction = ParameterDirection.Output
selectNewAnchorCommand.Parameters("@" + SyncSession.SyncBatchCount).Direction = ParameterDirection.InputOutput
Me.SelectNewAnchorCommand = selectNewAnchorCommand
Me.BatchSize = 50
Vedere anche
Riferimento
Classe DbServerSyncProvider
Membri DbServerSyncProvider
Spazio dei nomi Microsoft.Synchronization.Data.Server