views:

103

answers:

1

Struggling here, many documents I find are CF 1.0 centric and talk of the 2.0 changes to allow generics and typed DS'es on CF 2.0. Well, CF 2.0 has come and gone, and MS still shows these without update.

I am not ready to jump into WCF, and my clients have a lot of older compact framework 2.0 machines. I am fortunate in that these Web services are private and pretty closed.

So, my questions:

1) Are typed datasets or generics supported using vb.net CF 2.0? As I read they are not, or partially not, being serialized as an array, is this a bad thing?

2) In sending and returning small sets of data, no more than 20 rows, I have some older methods, string arrays, which send a much smaller envelope than a dataset. Is this still a good way to work or is there something better? I am passing 5-6 elements in string array and getting reasonable performance. The downside of these are preprocessing data into string arrays from datareaders or datasets.

3) Using the ds as a vehicle, I find coding is very quick and easy. I am using the getchanges method and sending very few rows at a time. If my envelopes are under 150K am I a criminal for doing it this way?

Thanks!

A: 

1) Generics are supported in .NET Compact Framework 2.0, but I'm not sure about typed datasets. I can tell you that untyped datasets are not recommended on the .NET Compact Framework for performance reasons, they're terrible slow to process and take up a lot of memory in comparison to other methods, such as a generic list.

2) You'd have to weigh the time that it takes to turn your data into strings versus the time that it takes to turn a dataset into XML to send it over the wire. In the end, everything will end up as XML when it is sent over the web service. A dataset serialized into XML is going to take up a LOT more bytes than a simple string array... which leads into your third question.

3) I wouldn't say it's criminal but how often are you sending that data? 150k is a lot of data to send over a wireless or cell data connection and it's also a decent amount of data for a device with limited CPU and memory to serialize and send over the wire on a regular basis. XML serialization/deserialization is slowwwwww in .NET CF with large data sets. On the other hand, if this is something that happens once a day I'd say no big deal.

jspru
Thanks, for replying. I got generics working, but it won't serialize a list of a class or type with more than one member. A list of strings works tops, but a list of type CustClass won't serialize on the CF end. So, that one is out except for short lists. I think the array is best for this case. An array of types seems to serialize ok.I am lucky that this app in particular is a wifi app, and we have 500kb/s in all places, except under towers and behind buildings.
Davery
With regard to saving, I found an interesting approach to taking a DS, pulling changes out with "getchanges()" then removing all but my important columns (get rid of the notes, etc). This gets passed as data is saved, it is then re-integrated via the WS. Not bad, but I wish I could just send a lightweight object back.
Davery
Hmm, I've been able to serialize and deserialize a generic List<CustClass> of items before in a web service - this shouldn't be a problem in .NET 2.0 ASMX web services. Is your CustClass marked as [Serializable]? Also, some types cannot be serialized such as Dictionaries, Streams, etc. so you have to ignore those properties.
jspru