Frage

I'm asking this because I would like to store those command objects in appfabric cache and execute them at a later stage through a batch once a day. (to reduce the number of uneven database hits). These are pure update statements and don't return anything.

War es hilfreich?

Lösung

The short answer is yes. However I wouldn't recommend doing it. Instead I would just pass the query itself as a string and create the SQLCommand in the service.

This question explains how to pass an object from a client app to a WCF service; How to pass Client Objects to WCF Service

Basically if you create the SQLCommand object client side you're; 1) allocating/initializing an object 2) having that object serialized and deserialized into an equivalent object in the service.

If you pass it a string you're instead; 1) allocating/initializing a string 2) passing it to the service which allocates and initializes a SQLCommand object.

The latter is simpler and more efficient.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top