PC Review


Reply
Thread Tools Rate Thread

Synch via DataSet DiffGrams - is there a flaw here?

 
 
=?Utf-8?B?U2ltb24gS2V3aW4=?=
Guest
Posts: n/a
 
      17th Mar 2004
I'm looking at how best to synchronize a semi-connected client d/b with a central server d/b and thinking about serialized DataSets over Web Services. All well and good

On the client side I can do something like keeping a DataSet in memory and calling GetChanges() on it to send just a DiffGram of what has changed up to the server when I need to synch. This works fine; you only need to send changed data and a Command object on the server can process the DiffGram pretty much automatically

But. I then need to pick up server-side changes (made by other people, at some point in the past) and send them back down to the client to complete the synch. Obviously I can track what records are new/amended/deleted in my database. But I'd then like to do the same as the client->server leg. ie. get a DiffGram, serialize it back to the Client and use a Command object to update the client d/b. I don't want to send the whole data set back and it's obviously a much sweeter design if the same mechanism for updating is being used client and server side. Yet I can see no way to easily generate a DiffGram of my server changes. The database knows what rows are new/amended/deleted according to an internal scheme I can create, but how to end up with a DataSet whose rows have the relevant RowState? I can get there manually but it is ugly (eg. to make a row "Modified" I can make a non-destructive change to the row to change its RowState). But this surely defeats the object of using the in-built mechanism of ADO.Net. Am I missing something here

Right now the only solution I can see is to ignore DiffGrams as they seem to have this gap in what they do. I guess I can just serialize my own rows with their own flags and handle everything manually ...
 
Reply With Quote
 
 
 
 
Morten Mertner
Guest
Posts: n/a
 
      17th Mar 2004
You probably need to keep track of the server-side state at sync time,
such as by storing a timestamp or a revision counter on the data to
synchronize.

This would allow you to:
o Send diff to client
o Store revision counter for the client
o Receive diff from client
o Apply diff (no hassles here)
o Send diff between current state and client revision state

Keeping track of deleted stuff is always problematic. If your dataset
is not too large it may be easier to simply store the latest version
used in a sync (i.e. an xml snapshot) for every client (rather than
keeping track of revisions).

Yours,
Morten


Simon Kewin wrote:
> I'm looking at how best to synchronize a semi-connected client d/b with a central server d/b and thinking about serialized DataSets over Web Services. All well and good.
>
> On the client side I can do something like keeping a DataSet in memory and calling GetChanges() on it to send just a DiffGram of what has changed up to the server when I need to synch. This works fine; you only need to send changed data and a Command object on the server can process the DiffGram pretty much automatically.
>
> But. I then need to pick up server-side changes (made by other people, at some point in the past) and send them back down to the client to complete the synch. Obviously I can track what records are new/amended/deleted in my database. But I'd then like to do the same as the client->server leg. ie. get a DiffGram, serialize it back to the Client and use a Command object to update the client d/b. I don't want to send the whole data set back and it's obviously a much sweeter design if the same mechanism for updating is being used client and server side. Yet I can see no way to easily generate a DiffGram of my server changes. The database knows what rows are new/amended/deleted according to an internal scheme I can create, but how to end up with a DataSet whose rows have the relevant RowState? I can get there manually but it is ugly (eg. to make a row "Modified" I can make a non-destructive change to the row to change its RowState). But this surely defeats the object of using t

he in-built mechanism of ADO.Net. Am I missing something here?
>
> Right now the only solution I can see is to ignore DiffGrams as they seem to have this gap in what they do. I guess I can just serialize my own rows with their own flags and handle everything manually ...

 
Reply With Quote
 
=?Utf-8?B?U2ltb24gS2V3aW4=?=
Guest
Posts: n/a
 
      18th Mar 2004
Thanks for replying Morten

In fact I am using the revision counter approach server side - so I know what I'd like to put in my DiffGram. I just can't see a sweet way of doing so! Amends are reasonably easy - if I use ImportRow on rows which I know to be amended into a fresh DataSet, then I get the RowState of Modified. And since I'm doing Deletes as a special sort of Amend thaey work too. It's new rows that is the problem. If my d/b says a row is new I need to get it into a DataSet with a RowState of Added. The only way of found of doing this so far is by calling NewRow and copying the data cross column by column, which is horrible - and not very automatic. So much so that I couldn't help thinking I'd missed an obvious trick ...
 
Reply With Quote
 
=?Utf-8?B?U2ltb24gS2V3aW4=?=
Guest
Posts: n/a
 
      18th Mar 2004
Update : ImportDataRow() seems to be the key; it allows me to get my data but sets the RowState to Added. OK, so now it's only an ugly hack rather than a flaw in ADO.Net ...
 
Reply With Quote
 
Morten Mertner
Guest
Posts: n/a
 
      19th Mar 2004
Simon Kewin wrote:
> Update : ImportDataRow() seems to be the key; it allows me to get my
> data but sets the RowState to Added. OK, so now it's only an ugly
> hack rather than a flaw in ADO.Net ...


A hack is better than lots of manual work Glad you made it work!

Yours,
Morten
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning! Serious design flaw dataset / table adapter designer Jim Rand Microsoft ADO .NET 8 6th Dec 2006 07:52 PM
out of synch dataset and datagrid using CurrentRowIndex C# =?Utf-8?B?Um9icw==?= Microsoft Dot NET Framework Forms 0 2nd Jun 2006 03:35 AM
dataset.writexml and diffgrams, not writing well formed xml =?Utf-8?B?ZWR3YXJkbXVy?= Microsoft ADO .NET 1 5th Nov 2004 06:29 AM
Diffgrams =?Utf-8?B?Sko=?= Microsoft ADO .NET 3 5th May 2004 06:30 PM
diffgrams soosan Microsoft Dot NET 1 17th Mar 2004 08:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:33 PM.