Sync DB between Windows Mobile and MySQL

2019-06-05 03:19发布

问题:

I am trying to create a windows mobile application that contains a database and can occasionally be connected to the Internet. When connected, I would like to sync the local database with the central database server. The central server is a MySQL server. The local database can be anything (probably SQL Compact).

What I did so far:

  • Installed Microsoft Sync Framework
  • Installed MySQL for ADO.NET
  • Created a Smart Device Project
  • Created a WCF Library (from this tutorial)
  • Created a connection to the central MySQL database in the Server Explorer
  • Failed to create a Local Database Cache with the MySQL connection

The problem is that when I create a new Local Database Cache, the list of available connections does not include my MySQL connection. Furthermore, when I go to create a new connection, there is no MySQL Driver in the list (as opposed to the list available when creating a connection in the Server Explorer).

Any help? I feel that I got this Microsoft Sync Framework all wrong. Or that I am missing something.

I'm looking for tutorials as well. Google wasn't really helpful (neither was Microsoft for that matter).

Thank you in advance.

回答1:

I believe you might have to create a custom sync provider for MySQL, the ADO.NET provider you installed and the actual Sync provider are two different things.

I had a link to a walkthrough for building an Oracle provider, but I seem to have misplaced it. From what I can remember you need to derive your provider from ServerSyncProvider. You might want to check out the Sync Framework home page as they are likely to have a few posts and videos that should prove useful.

Hope it helps, I'll update this post if I manage to find that tutorial link.


Edit: This is the one I was looking for, but it's a little out of date (I suggest you also look at a few of the other posts under Projects). You might also want to look at this one.