Click here to Skip to main content
15,892,643 members
Articles / Web Development / ASP.NET

Inherit from ADO.NET DataSet to Create Your Own Business Objects

Rate me:
Please Sign up or sign in to vote.
4.67/5 (12 votes)
27 Oct 20046 min read 188.5K   3.1K   82  
Extend generated Strong Typed Datasets, add your own business-specific functionality to a real DataSet object. Binding to forms and updating to a database is all done by the .NET Framework. This is built on Shawn Wildermuth's a.k.a. ADO Guy's DataSetGenerator.
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="OrderSetBase" targetNamespace="http://tempuri.org/OrderSetBase.xsd" elementFormDefault="qualified"
	attributeFormDefault="qualified" xmlns="http://tempuri.org/OrderSetBase.xsd" xmlns:mstns="http://tempuri.org/OrderSetBase.xsd"
	xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
	xmlns:codegen="urn:schemas-microsoft-com:xml-msprop">
	<xs:element name="OrderSetBase" msdata:IsDataSet="true">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="Orders" codegen:typedName="OrderBase" codegen:typedPlural="OrdersBase">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Id" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" msdata:AutoIncrementSeed="-1"
								msdata:AutoIncrementStep="-1" />
							<xs:element name="Customer" type="xs:string" />
							<xs:element name="OrderDate" type="xs:dateTime" />
							<xs:element name="Timestamp" msdata:ReadOnly="true" type="xs:base64Binary" minOccurs="0" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="OrderDetails" codegen:typedName="OrderDetailBase" codegen:typedPlural="OrderDetailsBase">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Id" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" msdata:AutoIncrementSeed="-1"
								msdata:AutoIncrementStep="-1" />
							<xs:element name="OrderId" type="xs:int" />
							<xs:element name="Material" type="xs:string" />
							<xs:element name="Amount" type="xs:int" />
							<xs:element name="Timestamp" msdata:ReadOnly="true" type="xs:base64Binary" minOccurs="0" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:choice>
		</xs:complexType>
		<xs:unique name="OrderSetBaseKey1" msdata:PrimaryKey="true">
			<xs:selector xpath=".//mstns:OrderDetails" />
			<xs:field xpath="mstns:Id" />
		</xs:unique>
		<xs:unique name="OrderSetBaseKey2" msdata:PrimaryKey="true">
			<xs:selector xpath=".//mstns:Orders" />
			<xs:field xpath="mstns:Id" />
		</xs:unique>
		<xs:keyref name="OrdersOrderDetails" refer="OrderSetBaseKey2">
			<xs:selector xpath=".//mstns:OrderDetails" />
			<xs:field xpath="mstns:OrderId" />
		</xs:keyref>
	</xs:element>
</xs:schema>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Software Developer
Netherlands Netherlands
My first encounters with computers where Sinclair, TI99-4A, C64, Apple II. Have programmed ever since. Worked for a few logistic companies.
I have been a VB.NET programmer for quite some years. I work with a small firm, that specializes in supply chain planning for bulk products. We have our own application, Delivery+, that helps vehicle planners with their daily job.
I am married and I have two children. I am building an eco-friendly house and try to live green.

Comments and Discussions