Separating out common data tables in datasets?

  • Thread starter Thread starter Clive Dixon
  • Start date Start date
C

Clive Dixon

If I create two datasets using the visual designer which both contain the
same table, the generated datasets will each have their own nested copy of
the same table class. Ideally I would like to be able to have datasets use a
single copy of a class for a common table, so that I can write common code
using the single class rather than have to write stuff twice. Is there any
way of being able to do this with VS 2005 and the visual designer?
 
Create a singleton and have the singleton pass a reference to the dataset
instance as in

bsOfficeIdxUrl.DataSource =
Helpers.LookupTableSingleton.Instance.dsLookupTbls;

Jim
 
Jim Rand said:
Create a singleton and have the singleton pass a reference to the dataset
instance as in

bsOfficeIdxUrl.DataSource =
Helpers.LookupTableSingleton.Instance.dsLookupTbls;

Jim

I think you're misunderstnading what I'm looking for. I'm not looking for
data binding to instances, I'm looking for class generation by the visual
designer. If I create two dataset classes which both have a table in common,
I will get some source code which conceptually looks like

class Dataset1
{
CommonDataTable table;

class CommonDataTable
{
}
}

class Dataset2
{
CommonDataTable table;

class CommonDataTable
{
}
}

i.e. I have two identically-defined classes Dataset1.CommonDataTable and
Datset2.CommonDataTable.
What I want is to be able to use the visual designer still, but have source
code output which looks conceptually like:

class CommonDataTable
{
}

class Dataset1
{
CommonDataTable table;
}

class Dataset2
{
CommonDataTable table;
}

so that I can write code once once only to use the single class
CommonDataTable, not to have to write the same code twice to use the two
separate classes Dataset1.CommonDataTable and Dataset2.CommonDataTable.
 
Back
Top