Datasets in Visual Studio Overview -
Typed Versus Untyped Datasets
A typed dataset is a dataset that is first derived from the base DataSet class and then uses information from the Dataset Designer, which is stored in an .xsd file, to generate a new strongly-typed dataset 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 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.)
Yes you can automatically generate these with Visual Studio:
Or, you can create your own strongly typed DataSets (this is cleaner IMO). Example:
using System.Data;
public class CatsDataTable : DataTable
{
public CatsDataTable() : base()
{
base.TableName = "cats";
Columns.Add(new DataColumn(SqlTokens.id_cats, typeof(int)));
Columns.Add(new DataColumn(SqlTokens.owners_id_owners, typeof(int)));
Columns.Add(new DataColumn(SqlTokens.cats_name, typeof(string)));
Columns.Add(new DataColumn(SqlTokens.cats_number_of_spots, typeof(int)));
}
}
public class OwnersDataTable : DataTable
{
public OwnersDataTable() : base()
{
base.TableName = "owners";
Columns.Add(new DataColumn(SqlTokens.id_owners, typeof(int)));
Columns.Add(new DataColumn(SqlTokens.owners_name, typeof(string)));
}
}
public class PetsDataSet : DataSet
{
public PetsDataSet() : base()
{
base.TableName = "pets";
Tables.Add("cats");
Tables.Add("owners");
}
}
Tangent about Garbage Collection
garbage collection (GC) is a form of automatic memory management. It is a special case of resource management, in which the limited resource being managed is memory. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. (wikipedia)