Serializing Object Model
From a web service I'm serializing out an object model. Is there a way to
only include those elements of the object model which actually contain data?
Re: Serializing Object Model
"Dave T" <DaveT@discussions.microsoft.com> wrote in message
> From a web service I'm serializing out an object model. Is there a way to
> only include those elements of the object model which actually contain
It can be done, you will need a to write custom serializer for for that.
I've written one before and don't remember it being too difficult.
If you do that, though, you may have trouble deserializaing the result to
any wsdl-generated classes you may be using on the consumer side. To get
around that you could break down the object in question into a hierarchy of
classes; in that case you could probably eliminate your need for a custom
serializer to crop away empty fields altogether if you're dealing with a
broad yet deep tree of data.
All that being said: if your reason for doing this is size, I wouldn't
bother; 99% of the time doing this would be poor design, and if you turn on
(or manually implement) compression you'll find that XML data shrinks by a
factor of 30 because of its high tokenization.
|All times are GMT. The time now is 12:10 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.