Share via


DbSyncAdapter.DeleteMetadataCommand Property

Gets or sets the query or stored procedure that is used to delete metadata from the metadata table.

Namespace:  Microsoft.Synchronization.Data
Assembly:  Microsoft.Synchronization.Data (in Microsoft.Synchronization.Data.dll)

Syntax

'Declaration
Public Property DeleteMetadataCommand As IDbCommand
    Get
    Set
'Usage
Dim instance As DbSyncAdapter
Dim value As IDbCommand

value = instance.DeleteMetadataCommand

instance.DeleteMetadataCommand = value
public IDbCommand DeleteMetadataCommand { get; set; }
public:
property IDbCommand^ DeleteMetadataCommand {
    IDbCommand^ get ();
    void set (IDbCommand^ value);
}
member DeleteMetadataCommand : IDbCommand with get, set
function get DeleteMetadataCommand () : IDbCommand
function set DeleteMetadataCommand (value : IDbCommand)

Property Value

Type: System.Data.IDbCommand
An IDbCommand object that contains a query or stored procedure.

Remarks

Synchronization adapter commands enable you to specify the queries and stored procedures that are used to select from and apply data and metadata changes to a peer database. For more information, see How to: Provision a Server Database for Collaborative Synchronization (Non-SQL Server). Each command uses session variables that enable you to pass values during synchronization. These variables are specified like other parameters to queries or stored procedures in ADO.NET commands. For more information, see How to: Use Session Variables for Collaborative Synchronization (Non-SQL Server).

Examples

The following code example creates a command that deletes metadata rows from the Customer_Tracking table at a peer. The command is a stored procedure that is defined in Setup Scripts for Database Provider How-to Topics. To view this code in the context of a complete example, see How to: Provision a Server Database for Collaborative Synchronization (Non-SQL Server).

SqlCommand delMetadataCustomerCmd = new SqlCommand();
delMetadataCustomerCmd.CommandType = CommandType.StoredProcedure;
delMetadataCustomerCmd.CommandText = "Sync.sp_Customer_DeleteMetadata";
delMetadataCustomerCmd.Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier);
delMetadataCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int);
delMetadataCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncRowTimestamp, SqlDbType.BigInt);
delMetadataCustomerCmd.Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output;

adapterCustomer.DeleteMetadataCommand = delMetadataCustomerCmd;
Dim delMetadataCustomerCmd As New SqlCommand()

With delMetadataCustomerCmd
    .CommandType = CommandType.StoredProcedure
    .CommandText = "Sync.sp_Customer_DeleteMetadata"
    .Parameters.Add("@CustomerId", SqlDbType.UniqueIdentifier)
    .Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int)
    .Parameters.Add("@" + DbSyncSession.SyncRowTimestamp, SqlDbType.BigInt)
    .Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output
End With

adapterCustomer.DeleteMetadataCommand = delMetadataCustomerCmd

See Also

Reference

DbSyncAdapter Class

Microsoft.Synchronization.Data Namespace