I'm currently writing an application based on Web-services handling the
exchange of data between client-applications (consumers) and the Data Access
Layer. Consumers can be either .Net-based or based on other platforms (e.g.
Java). For potential .Net based clients I provide a layer that wraps the
web services, abstracting away any knowledge of the transport mechanism
used, i.e. the same functionality could possibly utilise .Net-remoting
without the client being aware of this.

The problem I have is when the client has made one or more changes to a
dataset (e.g. having changed one or more rows). The client code accessing
the Web-service looks like this:

public class WsChangeAddressUseCaseAdapter : AbstractUseCaseAdapter {

private IssHogai.Common.XSD.Account.AddressData addressDataDelta;

public WsChangeAddressUseCaseAdapter
(IssHogai.Common.XSD.Account.AddressData addressData) {
this.addressDataDelta = (IssHogai.Common.XSD.Account.AddressData)
addressData.GetChanges (DataRowState.Modified);

public override System.Data.DataSet Execute() {
if (addressDataDelta != null) {
WSUseCaseFacade.ChangeAddress (addressDataDelta.GetXml ());
return null;

As you can see, I'm passing only the modified data to the service thereby
reducing network traffic.

The code for ChangeAddress looks like this:

public void ChangeAddress (AddressData data) {
foreach (AddressData.AddressRow row in data.Address) {
base.AddParameter ("PKId", row.PKId);
prepareAddressParameters (row);
base.execute ("UpdateAddress");

And this is where trouble starts, because the row state of each 'row' in the
code above is 'Added' and not 'Modified' as we would like it to be. If we
pass this dataset to a DataAdapter, the wrong method will be called and the
rows inserted instead of updated. So my question is: is there a way to
preserve the row state across the XML-serialisation and deserialisation? If
not, what are my options? And of course, what about those non-.Net clients?


Eirik M.