简体   繁体   English

在Windows桌面应用程序和Windows Mobile客户端应用程序之间同步数据

[英]Sync data between a windows desktop app and windows mobile client app

I need to knock up a very quick prototype/proof of concept application to demo to someone within the next couple of days so I've minimal time to research this as fully as I normally would. 我需要敲定一个非常快速的原型/概念验证应用程序,以便在接下来的几天内向某人进行演示,因此,我花了最少的时间像平时一样全面地进行研究。 The set-up is a very simple database application running on a laptop - will only ever be a single user updating a couple of tables so I was thinking of knocking up a basic Win Forms app against SQL Compact. 该设置是在笔记本电脑上运行的一个非常简单的数据库应用程序-只能是一个用户来更新几个表,因此我想针对SQL Compact敲打一个基本的Win Forms应用程序。 Visual Studio's auto generated data grid edit screens will be fine with a little customisation. 只需进行一点自定义,Visual Studio的自动生成的数据网格编辑屏幕就可以了。 The second aspect is to then add a windows mobile client application that can pull data from both tables stored on the laptop, edit some data and insert some extra rows before sending the changes back to the laptop copy of the database. 第二个方面是,然后添加一个Windows Mobile客户端应用程序,该应用程序可以从存储在便携式计算机上的两个表中提取数据,编辑一些数据并插入一些额外的行,然后再将更改发送回数据库的便携式计算机副本。

I've not done any WinMo development so what's the best approach for me to look at. 我没有做过WinMo开发,所以对我来说最好的方法是什么。 Is it easy enough to sync data between the two databases when the WinMo device is connected to the laptop with USB? 当WinMo设备通过USB连接到笔记本电脑时,在两个数据库之间同步数据是否足够容易?

Most of the samples I've looked at so far seem to be syncing SQL Compact with SQL Standard using IIS which seems a bit overkill. 到目前为止,我看过的大多数示例似乎都在使用IIS将SQL Compact与SQL Standard同步,这似乎有些过分。 The volumes of data to be synced are so small that I can easily write some manual sync code if it's easy for me to query/update the Compact DB from the laptop application when the device is connected. 要同步的数据量非常小,如果在连接设备时很容易从便携式计算机应用程序查询/更新Compact DB,那么我可以轻松编写一些手动同步代码。

Edit: 编辑:

I've seen mention that a quick and easy solution is to use RAPI - when the device is connected copy the DB to the laptop, connect and do the necessary magic and then copy it back to the device. 我已经提到过,一种快速简便的解决方案是使用RAPI-连接设备后,将数据库复制到笔记本电脑,进行连接并执行必要的操作,然后再将其复制回设备。 Any problems with this approach? 这种方法有什么问题吗? This is a single laptop user with a single mobile device user to sync up so it's pretty basic stuff. 这是一个笔记本电脑用户,一个移动设备用户需要同步,所以这是非常基本的东西。 In any single sync the volume of updates is likely to be less than 10 records. 在任何单个同步中,更新量可能少于10条记录。

Take a look at Microsoft's Sync Framework . 看一下Microsoft的Sync Framework The have examples of synchronizing SQLCE as well as contact data . 同步SQLCE联系数据的示例。 The Sync Developer Center page has loads of info as well. 同步开发人员中心页面也包含大量信息。

Trying to do this manually is not fun. 尝试手动执行此操作并不有趣。 It sounds easy, but once you get into things like collision detection, precedence, transactions, guaranteed delivery and loads of other stuff you'll find it really isn't as straightforward as you might think. 这听起来很简单,但是一旦您遇到诸如冲突检测,优先级,事务,有保证的交付和加载其他内容之类的事情,您会发现它确实并不像您想象的那么简单。

EDIT 编辑

If your scenario really is as easy as you say (ie it's not really a sync, but a data copy) then yes, RAPI is probably the easiest mechanism if ActiveSync exists and is acceptable as part of the solution. 如果您的方案确实像您说的那样简单(即,它实际上不是同步,而是数据副本),那么可以, 如果 ActiveSync存在, RAPI可能是最简单的机制 ,并且可以作为解决方案的一部分。 It's nice because you don't have to write the transport infrastructure, and if what's in the box in't enough, you can always write custom RAPI extensions . 很好,因为您不必编写传输基础结构,并且如果包装盒中的内容不够用,则始终可以编写自定义RAPI扩展

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

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