R – web services, generics, typed DS, on Compact framework 2.0, current (2009) best practices

compact-frameworkgenericsnetstrongly-typed-datasetweb services

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!

Best Answer

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.