---
title: "Typed Dataset Q&A"
url: "https://osherove.com/blog/2003/6/20/typed-dataset-qampa.md"
canonical: "https://osherove.com/blog/2003/6/20/typed-dataset-qampa.html"
published: "2003-06-20T12:53:00"
updated: "2003-06-20T12:53:00"
tags: [".Net Quotations"]
author: "Roy Osherove"
description: "Q: I need to get the best possible performance out of my middle-tier components, so I'm using untyped DataSet objects on the server. But strongly typed DataSet objects are so handy when I build the client portion of the…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Typed Dataset Q&A

By Roy Osherove June 20, 2003 In [.Net Quotations](https://osherove.com/blog/category/net-quotations)

**Historical article** · Originally published June 20, 2003; technical details may be outdated.

<table><tbody><tr><td><b><em>Q:</em></b></td><td><p><em>I need to get the best possible performance out of my middle-tier components, so I'm using untyped <span>DataSet </span>objects on the server. But strongly typed <span>DataSet </span>objects are so handy when I build the client portion of the application. Is there a way to get the best of both worlds?</em></p></td></tr><tr><td><b><em>A:</em></b></td><td><p><em>Yes. Have your middle tier return and accept untyped <span>DataSet </span>objects. Use instances of strongly typed <span>DataSet </span>objects in the client application, and use the <span>Merge </span>method to import the contents of the untyped <span>DataSet </span>objects returned by the middle tier.</em></p></td></tr><tr><td><b><em>Q:</em></b></td><td><p><em><span>DataSet </span>objects offer limited validation features. I can't set properties on either an untyped or a strongly typed <span>DataSet </span>to ensure that the value of a column falls between certain limits. Can I add my own code to the class file for added validation?</em></p></td></tr><tr><td><b><em>A:</em></b></td><td><p><em>Of course. You can add validation code to the desired properties of your strongly typed classes, but this was not an intended use of the strongly typed <span>DataSet</span>. Your validation code will not be stored in the .xsd file for the strongly typed <span>DataSet</span> class. If you modify the contents of the .xsd file, Visual Studio .NET will regenerate the class for the strongly typed <span>DataSet</span> and you'll lose the code that you've written.</em></p><p><em>You have another option: create a new class that inherits from the strongly typed <span>DataSet </span>class and add your validation code there.</em></p></td></tr></tbody></table>

\[via [ADO.NET Core Reference](https://www.amazon.com/exec/obidos/ASIN/0735614237/qid=1056123818/sr=1-1/ref=sr_1_1/iserializable-20)\]

This is easily one of the best tech books I've read, especially on this subject. Heartily recommended. They have this Q&A section on every big subject that is covered, and the questions are to the point. Way to go!

## More in .Net Quotations

[All posts in .Net Quotations](https://osherove.com/blog/category/net-quotations)

- Jun 28, 2003

    ### [Nice page of ADO.NET notes & tips](https://osherove.com/blog/2003/6/28/nice-page-of-adonet-notes-amp-tips.html)

- Jun 22, 2003

    ### [More About Processes](https://osherove.com/blog/2003/6/22/more-about-processes.html)

- Jun 18, 2003

    ### [Very Good Winforms FAQ](https://osherove.com/blog/2003/6/18/very-good-winforms-faq.html)

- Jun 17, 2003

    ### [.Net Shortcuts + Automate GAC and COM operations using this Cool Add-in](https://osherove.com/blog/2003/6/17/net-shortcuts-automate-gac-and-com-operations-using-this-coo.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
