«

Annotating Strongly Typed Datasets

I didn’t get the “Strongly Typed DataSet-Data Adapter Factory” thing at first. Chris Hollander showed me the light, and now I’m a true believer.

One of the few things I haven’t liked about Strongly Typed DataSets is having objects named things like “UserRow” instead of just “User”. Well, I stumbled onto a cool article on MSDN about annotating strongly typed datasets. Basically, you can use custom attributes in your schema to control the names of the objects created by the XSD tool.

For Example:

<xs:elementname=”Users” />

becomes:

<xs:elementname=”Users” codegen:typedName=”User” codegen:typedPlural=”Users”>

and “UserRow” becomes “User”. It’s not a big deal, but it goes a little way towards plugging what I consider a leak in the abstraction.