I’ve been using Web Services for many years prior to .Net, but with .Net I continue to have some serious mind blocks in terms of how to best pass data between the client and server, specifically when passing data in the form of objects/entities.


The problem I have is that in my business scenarios I usually have business objects both on the client and on the server. I download data from the server, then stick it into client side objects that often times are identical to the server side objects. The problem is .Net does not make this sort of thing easy with its proxy based approach. 


The problem is that .Net creates proxy copies of my business objects. These objects are only container shells of the full objects. They get created even if there is nothing omitted from the original object as is the case in a typical entity object. Instead I end up with a weak shell of an object that servers for nothing more than transport.


Once the data arrives on the other end I can’t use the data as is. I have to now move this data into my real business objects that actually do the work on the data. Note that this is true even if I create pure data container classes that don’t include methods.


I keep asking this question and I keep getting blank stares from people – am I really out of my mind here? This seems like a very common scenario. Most people then continue to tell me to pass DataSets across the wire, which works a little better, but even there similar issues exist. If I pass a dataset to the client app I still have to go through all sorts of rigamorole to reattach the data I downloaded to my real life business objects by merging or otherwise kludging the data logic to force the DataSet into the right state on the client.


I’m writing about this because I’m curious for some input. Is everybody really using mostly DataSets to pass data over the wire instead of objects? I mean this completely goes counter the whole OO paradigm of dealing with data in the first place. The Proxy approach works well in true disconnected to the server scenarios, but it's not a good match for side by side applications which in my work tends to be the more common case. Side by side meaning two separate sets of data on the client and server with data being shared between the two as opposed to a central database that is always updated on the server.


What I would like to see at the least is an easier mechanism to map types for the proxies generated. I know I can do this by writing custom code, but it would be nice if we could specify the classes that are used for proxies conditionally.


Another area that would be useful would be tools to facilitate object copying. I’ve built my own routines to do this and true it isn’t rocket science, but this happens frequently enough that it sure would be nice to have a generic way to clone a serializable object easily. So when I get back my AuthorProxyEntity I can then assign it easily to my live Authors.AuthorEntity instance.


I do this now with a cheesy Reflection based CopyObjectData() method, which basically goes through the target object and copies any properties it can match from the source object. I have the same sort of thing for a DataRow object which guarantees that the data retrieved is in the proper update state.


So, am I off my nut? What are other people doing to pass data around and avoid having to write and re-write object parsing code each time?