SyncAgent.LocalProvider 속성
로컬 데이터 저장소와 통신하는 데 사용되는 ClientSyncProvider에서 파생된 개체를 가져오거나 설정합니다.
네임스페이스: Microsoft.Synchronization
어셈블리: microsoft.synchronization.data.dll의 Microsoft.Synchronization.Data
구문
‘선언
Public Property LocalProvider As SyncProvider
‘사용 방법
Dim instance As SyncAgent
Dim value As SyncProvider
value = instance.LocalProvider
instance.LocalProvider = value
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)
속성 값
ClientSyncProvider에서 파생된 개체입니다.
예제
다음 코드 예제에서는 SyncAgent에서 파생되는 클래스를 만듭니다. 이 클래스는 클라이언트 동기화 공급자와 서버 동기화 공급자를 인스턴스화하고 동기화 그룹을 만들며 Customer
테이블을 추가합니다. 테이블을 추가할 때 동기화 방향과 테이블 생성 옵션도 지정됩니다. 전체 예제의 맥락에서 이 코드를 보려면 방법: 클라이언트와 서버 간에 양방향 증분 데이터 변경 내용 교환을 참조하십시오.
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