简体   繁体   English

使用Sync Framework 2.1将SQL Server 2008和SQL Server 2008 Express与WCF同步

[英]Using Sync Framework 2.1 to synchronise SQL Server 2008 and SQL Server 2008 Express with WCF

We have built an application which synchronises a central SQL Server 2008 database with multiple client SQL Server 2008 Express databases. 我们已经构建了一个应用程序,该应用程序可将中央SQL Server 2008数据库与多个客户端SQL Server 2008 Express数据库同步。

Although this application is successful we would like to ensure that the transfer of data is secure. 尽管此应用程序成功完成,但我们希望确保数据传输的安全性。 In order to do so we are trying to re-write our application to synchronise using a web service implemented with WCF. 为此,我们尝试使用WCF实现的Web服务重新编写应用程序以进行同步。

The example in the following article seems very good and I have managed to re-write most of our application. 下一篇文章中的示例看起来非常好,我已经设法重写了大部分应用程序。 http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208#content http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208#content

However, in our application we need to assign the ApplyChangeFailed event handler to both the local provider and the remote provider. 但是,在我们的应用程序中,我们需要将ApplyChangeFailed事件处理程序分配给本地提供程序和远程提供程序。 (please see example code below) (请参见下面的示例代码)

((SqlSyncProvider)_syncOrchestrator.LocalProvider).ApplyChangeFailed += new EventHandler(SynchronisationWizardClient_ApplyChangeFailed); ((SqlSyncProvider)_syncOrchestrator.LocalProvider).ApplyChangeFailed + =新的EventHandler(SynchronisationWizardClient_ApplyChangeFailed);

((SqlSyncProviderProxy)_syncOrchestrator.RemoteProvider).ApplyChangeFailed += new EventHandler(SynchronisationWizardServer_ApplyChangeFailed); ((SqlSyncProviderProxy)_syncOrchestrator.RemoteProvider).ApplyChangeFailed + =新的EventHandler(SynchronisationWizardServer_ApplyChangeFailed);

As the Remote provider is now a SqlSyncProviderProxy object the ApplyChangeFailed event is not available. 由于远程提供程序现在是SqlSyncProviderProxy对象,因此ApplyChangeFailed事件不可用。

The example in the article does not use the ApplyChangeFailed event so there is no reference to it in any of the sample code. 本文中的示例未使用ApplyChangeFailed事件,因此在任何示例代码中均未引用该事件。 I assume we need to amend some of the WCF contracts and classes in order to be able to set ApplyChangeFailed on our SqlSyncProviderProxy. 我假设我们需要修改一些WCF合同和类,以便能够在SqlSyncProviderProxy上设置ApplyChangeFailed。

Does anyone know how this can be done? 有谁知道该怎么做?

are you sure you want the WCF service to call back your client everytime ApplyChangeFailed event is raised? 确定要在每次引发ApplyChangeFailed事件时WCF服务都回调您的客户端吗?

The WCF service has the reference to the SqlSyncProvider, you can handle the ApplyChangeFailed event on the service side without having to send it back to the client. WCF服务具有对SqlSyncProvider的引用,您可以在服务端处理ApplyChangeFailed事件,而不必将其发送回客户端。 If you need to resolve conflicts, you can resolve it on the service side. 如果需要解决冲突,则可以在服务端解决冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM