Home All Groups Group Topic Archive Search About

Separating out common data tables in datasets?

Author
1 May 2007 3:06 PM
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?

Author
1 May 2007 3:29 PM
Jim Rand
Create a singleton and have the singleton pass a reference to the dataset
instance as in

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

Jim

Show quote
"Clive Dixon" <clived at digita dot com> wrote in message
news:uAGkfIAjHHA.1220@TK2MSFTNGP03.phx.gbl...
> 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?
>
Author
1 May 2007 4:22 PM
Clive Dixon
Show quote
"Jim Rand" <jimr***@ix.netcom.com> wrote in message
news:Opst1VAjHHA.5012@TK2MSFTNGP04.phx.gbl...
> Create a singleton and have the singleton pass a reference to the dataset
> instance as in
>
> bsOfficeIdxUrl.DataSource =
> Helpers.LookupTableSingleton.Instance.dsLookupTbls;
>
> Jim
>
> "Clive Dixon" <clived at digita dot com> wrote in message
> news:uAGkfIAjHHA.1220@TK2MSFTNGP03.phx.gbl...
>> 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?
>>
>

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.

AddThis Social Bookmark Button