Link to home
Start Free TrialLog in
Avatar of wile_e_coyote
wile_e_coyote

asked on

Typed vs Untyped DataSets

What are the pro's and con's of typed vs untyped DataSets when used with Web Services?   This is related to my other post regarding slow client performance when creating the web service proxy object.  I'm wondering if
having each web method return an untyped DataSet would result in a smaller proxy object on the client.

In our case, currently each typed DataSet encapsulates a single DataTable. We use the DataSet for both and update/insert/delete operations.

Avatar of naveenkohli
naveenkohli

The biggest advantage that typed datasets provide is the what the description says.. It is strongly typed. What that means is that instead of accessing fields or tables through generic data objects like DataTable, Row[0] etc, you will accessing information through properties on the strongly typed data set classes. This avoids lot of run time errors that can happen due to misspeliings or wrong indices of columns being accessed. This definitely gives lot of advantages by providing compile type error checking.

The only disadvantage i can think of this that if the schema of your table changes, then you will have to recreate the class and compile the code again.
From MSDN:

Datasets can be typed or untyped. A typed dataset is a dataset that is first derived from the base DataSet class and then uses information in an XML Schema file (an .xsd file) to generate a new class. Information from the schema (tables, columns, and so on) is generated and compiled into this new dataset class as a set of first-class objects and properties.

Because a typed DataSet class inherits from the base DataSet class, the typed class assumes all of the functionality of the DataSet class and can be used with methods that take an instance of a DataSet class as a parameter

An untyped dataset, in contrast, has no corresponding built-in schema. As in a typed dataset, an untyped dataset contains tables, columns, and so on — but those are exposed only as collections. (However, after manually creating the tables and other data elements in an untyped dataset, you can export the dataset's structure as a schema using the dataset's WriteXmlSchema method.)

You can use either type of dataset in your applications. However, Visual Studio has more tool support for typed datasets, and they make programming with the dataset easier and less error-prone.

Avatar of wile_e_coyote

ASKER

naveenkohli and Massiel_VB

These are both good answers - how about splitting the points?  (You'll each get 25 points)
sounds good :-)
ASKER CERTIFIED SOLUTION
Avatar of Netminder
Netminder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial