views:

80

answers:

2

Hello,

I would like to know which is faster. Let me give you the scenario. I'm on a LAN, have a report to build using data from a SQL Server database (if we need the version let's say 2005) and have these ways of getting the report done:

(1). Have a web service at the server, where the data is taken from the server and serialized into XML. The client uses this XML as a source for a report that is built in the client machine. The cliente would be a windows form app.

(2). From the client side, connect to the database using ADO.Net, get a DataTable and uses as a source for the report built in the client.

(3). The same as (2) but using a DataReader.

Also, is there a better way to do this?

Hope I stated the problem well.

Thanks!

Sebastian

+2  A: 

The best practice is to not use .NET-specific types in the interface of a web service. Even if you are certain today that your service will never be called by anything other than a .NET program, things change, and tomorrow you may be told that the service will be called by a Perl program.

Perl programs don't understand DataSet. Nor do Java programs, nor anything other than .NET.

The best practice is to create a Data Transfer Object containing just the data you need to transfer, in simple properties with primitive types, or collections or arrays of primitive types, or collections or arrays of Data Transfer Objects, etc. These will be understandable by any client.

John Saunders
i don't know about that. Design for what you know. Don't spend time coding foe XML, when it isn't likely. i'm a fan of interoperability, but i'm a bigger fan of not wasting time on something that isn't an immediate need. if there is no business value added, don't do it.
geowa4
I agree to design for what you know. You know things change daily. You knew web services can be interoperable for little more than the cost of not trying to **not** be interoperable. Don't go all out of your way for no good reason, but it's simple to design so that web services can do the interop work for you.
John Saunders
+3  A: 

The serialization to XML is going to cost both in terms of the time it takes to do it, the overhead of the XML structure, and the time to deserialize. It will, however, provide a format that is consumable by more technologies. If you are using .NET end-to-end, and that isn't likely to change, I would not use XML, but use the framework-provided data access methods. Personally, I would probably use LINQ over DataTables or a DataReader but that more for ease of use and readability on the client-side than any performance advantage.

tvanfosson