SyncAgent.LocalProvider Property

Gets or sets an object derived from ClientSyncProvider that is used to communicate with the local data store.

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

Syntax

'Declaration
Public Property LocalProvider As SyncProvider
public SyncProvider LocalProvider { get; set; }
public:
property SyncProvider^ LocalProvider {
    SyncProvider^ get ();
    void set (SyncProvider^ value);
}
/** @property */
public SyncProvider get_LocalProvider ()

/** @property */
public void set_LocalProvider (SyncProvider value)
public function get LocalProvider () : SyncProvider

public function set LocalProvider (value : SyncProvider)

Property Value

An object derived from ClientSyncProvider.

Example

The following code example creates a class that derives from SyncAgent. The class instantiates a client synchronization provider and a server synchronization provider, creates a synchronization group, and adds the Customer table. When adding the table, synchronization direction and a table creation option are also specified. To view this code in the context of a complete example, see How to: Exchange Bidirectional Incremental Data Changes Between a Client and Server.

public class SampleSyncAgent : SyncAgent
{
    public SampleSyncAgent()
    {            
        //Instantiate a client synchronization provider and specify it
        //as the local provider for this synchronization agent.
        this.LocalProvider = new SampleClientSyncProvider();

        //Instantiate a server synchronization provider and specify it
        //as the remote provider for this synchronization agent.
        this.RemoteProvider = new SampleServerSyncProvider();

        //Create a Customer SyncGroup. This is not required
        //for the single table we are synchronizing; it is typically
        //used so that changes to multiple related tables are 
        //synchronized at the same time.
        SyncGroup customerSyncGroup = new SyncGroup("Customer");

        //Add the Customer table: specify a synchronization direction of
        //Bidirectional, and that an existing table should be dropped.
        SyncTable customerSyncTable = new SyncTable("Customer");
        customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
        customerSyncTable.SyncDirection = SyncDirection.Bidirectional;
        customerSyncTable.SyncGroup = customerSyncGroup;
        this.Configuration.SyncTables.Add(customerSyncTable);
    }
}
Public Class SampleSyncAgent
    Inherits SyncAgent

    Public Sub New()
        'Instantiate a client synchronization provider and specify it
        'as the local provider for this synchronization agent.
        Me.LocalProvider = New SampleClientSyncProvider()

        'Instantiate a server synchronization provider and specify it
        'as the remote provider for this synchronization agent.
        Me.RemoteProvider = New SampleServerSyncProvider()

        'Create a Customer SyncGroup. This is not required
        'for the single table we are synchronizing; it is typically
        'used so that changes to multiple related tables are 
        'synchronized at the same time.
        Dim customerSyncGroup As New SyncGroup("Customer")

        'Add the Customer table: specify a synchronization direction of
        'Bidirectional, and that an existing table should be dropped.
        Dim customerSyncTable As New SyncTable("Customer")
        customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
        customerSyncTable.SyncDirection = SyncDirection.Bidirectional
        customerSyncTable.SyncGroup = customerSyncGroup
        Me.Configuration.SyncTables.Add(customerSyncTable)

    End Sub 'New
End Class 'SampleSyncAgent

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements (Synchronization Services).

Target Platforms

See Also

Reference

SyncAgent Class
SyncAgent Members
Microsoft.Synchronization Namespace