How to synchronize a SQL database using a smartphone to store and post changes? (There is no direct connection between source and target)

I have a scenario where my accidentally connected clients (WPF application, SQL Express DB) should synchronize with the central SQL Server. Client machines are used in the field, and often time does not have any connection. The plan is to use your smartphone as an intermediate storage and forwarding. The client will change local changes in the phone. Then turn off the phone, turn off the laptop and walk along the road. While driving, the phone will connect and upload the changes to the central office.

I need to know if I can do this using Sync Framework.

The documentation seems to indicate that synchronizing orchestration requires access to both the source and destination. In this case, I do not have a connection to the destination (central server). I suspect that I need to find a way to cache targeted knowledge locally, but I'm not sure if this works.

It may be worth noting that client machines will have direct connections on a periodic basis, but not daily.

So the script:

  • The client machine is directly connected on Monday and performs full synchronization.
  • On Tuesday, the user enters the field and uses the application, generating updates / inserts / deletes into the SQL Express database.
  • The user "synchronizes" the client computer with his smartphone. (Save file to SD card)
  • The user disconnects the client and drives along the road.
  • The smartphone connects to the network and uploads files to the central office.
  • The central office "synchronizes" the data from the downloaded file (s) into the central SQL Server database.
  • Repeat 2-6 on Wednesday, Thursday, Friday.
  • The next Monday, the user again connects directly for complete synchronization.

How to do it using Sync Framework?

Does it ever help me to download a smartphone daily from the central office (for example, knowledge of the central office)? Is there any harm if the client organizes a synchronization session against obsolete cached knowledge from the central office?

Thanks in advance!

+4
source share
1 answer

You cannot do this out of the box using the Sync Framework or the Sync Framework Toolkit. Database synchronization and file synchronization are completely different. The Sync Framework works with the concept of providers to represent synchronized repositories. For example, to work with files, you have FileSyncProvider to work with SQL Server / Express / Azure, you have SqlSyncProvider, etc ... but you cannot use FileSyncProvider to synchronize with SqlSyncProvider ... the former works with files, the last with rows in the database.

instead of synchronizing your smartphone with the local computer, synchronize the local machine and smartphone directly with the central server.

for the client machine, you can use the Sync Framework SDK and it is preferable to configure it in the n-level configuration using WCF.

for a smartphone, you will have to use the Sync Framework toolkit, since you cannot install the Sync Framework SDK on your phone.

here is a link to a sample using n-level configuration: Database synchronization: SQL Server and N-Tier SQL box with WCF

here is a link to the Sync Framework Toolkit : Microsoft Sync Framework Toolkit

0
source

Source: https://habr.com/ru/post/1412663/


All Articles