如何通过 WCF(n 层)同步两个 Sql Compact 版本数据库
我遇到的情况是,需要两个 SQL Compact 版本数据库在 C# 4 Winforms 应用程序中使用 Microsoft Sync Framework 相互同步,但我正在努力寻找一种方法来实现这一点。
我让它在 2 层类型的场景中足够轻松地工作,SqlCeSyncProvider 直接连接到服务器数据库,但我不确定如何通过 WCF 实现这一点。
我从 Microsoft 看到的示例基本上委托给 WCF 服务内的 SqlSyncProvider,但 SqlCeSyncProvider 似乎没有公开与 ServerSyncProviderProxy 相同的方法。
我可以在服务中使用 SqlCeClientSyncProvider (在这个问题中提到:使用 MS Sync Framework 同步两个 SQL CE Db),但 SqlCeClientSyncProvider 不公开 GetSchema 或 GetServerInfo 方法。我不知道我是否可以安全地忽略这些方法。
人们只是通过网络公开 SQLCe 数据库并使用 SqlCeSyncProvider 还是我错过了一些使这项工作有效的东西?
I have a situation that requires two SQL Compact edition databases to synchronise with each other using Microsoft Sync Framework in a C# 4 Winforms app, but I am struggling to find a way to get this to happen.
I have it working easily enough in a 2 tier type scenario, with SqlCeSyncProvider connecting directly to the server database, but am unsure about how to go about getting that to happen over WCF.
The samples I have seen from Microsoft are basically delegating to a SqlSyncProvider inside the WCF service, but the SqlCeSyncProvider doesn't appear to expose the same methods as the ServerSyncProviderProxy.
I could use a SqlCeClientSyncProvider inside the service (which is referred to in this question: Using MS Sync Framework to synchronize two SQL CE Dbs), but SqlCeClientSyncProvider does not expose GetSchema or GetServerInfo methods. I don't know if I can safely ignore those methods or not.
Are people just exposing the SQLCe databases over the network and using SqlCeSyncProvider or am I missing something that makes this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SqlCeClientSyncProvider/SyncAgent 组合不支持 SqlCe 数据库之间的同步,除非您想编写自己的使用 Sql Ce 的 DbServerSyncProvider。
请改用 SqlCeSyncProvider。
您可以在此处找到示例:数据库同步:SQL Server 和 SQL Compact N-具有 WCF 的层
只需修改它,使两个端点都是 Sql Ce
the SqlCeClientSyncProvider/SyncAgent combo doesnt support synching between SqlCe databases not unless you want to write your own DbServerSyncProvider that uses Sql Ce.
use SqlCeSyncProvider instead.
you can find a sample here: Database Sync: SQL Server and SQL Compact N-Tier with WCF
just modify it so both endpoints are Sql Ce