SyncProviderPosition 属性

获取或设置 SyncProviderPosition 枚举值,该枚举值表示提供程序是与本地数据库关联,还是与远程数据库关联。

命名空间:  Microsoft.Synchronization.Data
程序集:  Microsoft.Synchronization.Data(在 Microsoft.Synchronization.Data.dll 中)

语法

声明
Public Property SyncProviderPosition As SyncProviderPosition
    Get
    Set
用法
Dim instance As RelationalSyncProvider
Dim value As SyncProviderPosition

value = instance.SyncProviderPosition

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

属性值

类型:Microsoft.Synchronization. . :: . .SyncProviderPosition
SyncProviderPosition 枚举值,该枚举值表示提供程序是与本地数据库关联,还是与远程数据库关联。

示例

以下代码示例实例化本地提供程序和远程提供程序,并在已为此文档创建的一个简单类中调用 SetupSyncProvider 方法。之所以使用此方法,目的是能够轻松地为多个节点配置提供程序。在此方法中指定多个提供程序命令。有关这些命令的更多信息以及要在完整示例的上下文中查看此代码,请参见如何配置和执行协作同步(非 SQL Server)

DbSyncProvider localProvider = new DbSyncProvider();
DbSyncProvider remoteProvider = new DbSyncProvider();

//Create a provider by using the SetupSyncProvider on the sample class.             
sampleSyncProvider.SetupSyncProvider(localProviderConnString, localProvider);
localProvider.SyncProviderPosition = SyncProviderPosition.Local;

sampleSyncProvider.SetupSyncProvider(remoteProviderConnString, remoteProvider);
remoteProvider.SyncProviderPosition = SyncProviderPosition.Remote;
Dim localProvider As New DbSyncProvider()
Dim remoteProvider As New DbSyncProvider()

'Create a provider by using the SetupSyncProvider on the sample class.
sampleSyncProvider.SetupSyncProvider(localProviderConnString, localProvider)
localProvider.SyncProviderPosition = SyncProviderPosition.Local

sampleSyncProvider.SetupSyncProvider(remoteProviderConnString, remoteProvider)
remoteProvider.SyncProviderPosition = SyncProviderPosition.Remote

请参阅

参考

RelationalSyncProvider类

RelationalSyncProvider 成员

Microsoft.Synchronization.Data 命名空间