开发者

Local sync with Azure Table Storage

开发者 https://www.devze.com 2023-04-02 07:04 出处:网络
I want to sync data in the Azure Table Storage with a local windows desktop client. The desktop client should work without being online all the time so he has to download the newest data from the ATS

I want to sync data in the Azure Table Storage with a local windows desktop client. The desktop client should work without being online all the time so he has to download the newest data from the ATS and upload any changes which are made to the local data.

Is there something premade to take care of that or do I have to code this from scratch?

Maybe there are some articles on the net I didn't see开发者_运维问答 yet. I suppose the Sync Framework is the way to go here but I did not find anything specific on usage with the Azure Table Storage.


I think that actual syncing the data itself is the least of your problems. Actually emulating the azure storage while disconnected so that majority of your code is abstracted away from actual implementation is likely to be a lot more challenging. Azure Table Storage is hard to emulate. You can attempt to use SQL Express on the local client desktops and in it tables with PartitionKey, RowKey, TimeStamp, and xml-based BLOB to store the objects in a similar way that ATS does it, but it'll be pretty tough to get the to emulation properly.

I haven't seen any technologies or frameworks that do this. Is your need for capacity and/or scalability that great that you have to use Azure table storage? Can you do with SQL Azure instead? Running SQL Express on local desktop clients, syncing SQL Azure with SQL Express, and switching between the two data stores will be MUCH simpler.


A different approach would be to expose your data via a RESTful service (have a look at asp.net web api). The idea would be that you would simply call out to the a url to get your data

 GET //yourapi/someresource

In the header or the query string you can attach some data to help the service make the decision on what to give you back. In my case I pass up the device id (On Device Generated Guid) and a last sync timestamp.

Using these you can right a small sync manager behind the web service that gives you back all entities changed from other locations after a certain time. To keep all this in sync I have a sync journal in azure storage with has the userId, entityId, deviceId, Timestamp.

By querying and updating this table I can have the server quickly tell me what has changed and it is fast because the partition is per customer.

Since I have abstracted away the table storage I don't actually need to replicate it on the client, I can store the data however I want.


The Microsoft Sync Framework might help?

https://msdn.microsoft.com/en-us/library/bb902854(v=sql.110).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消