Although It would be very cool, I really don't think there is a way to
fullfill all your requirements. However when I need to share data along the
entire application (a Windows application). I do the following:
(1) create a typed dataset (DataSetMaster) with the datatables I need to
share
(2) Implement the singleton pattern on this dataset
(3) Create a new dataview class inherited form dataview for each datatable
in DataSetMaster. Something like this:
Public Class DataViewSomeTable
Inherits DataView
Public Sub New()
MyBase.New(DataSetMaster.SingletonInstance.SomeTable)
End Sub
End Class
In this way, when I drag a DataViewSomeTable from the toolbox and drop onto
some design surface, the DataViewSomeTable1 instance of DataViewSomeTable is
referencing always the same data, no matter how many instances you create,
all instances of DataViewSomeTable references the same DataTable instance.
And additionally I am allowed to perform design time databinding. That's all
I have got, sorry.
Another techique I have used is the following:
(1) the same as above
(2) the same as above
(3) Create a new component named ListSourceDatasetMaster. This componet
inherits from Component and implements IListSource. To implement IListSource
it relies on DataSetMaster.SingletonInstance.
Public Class ListSourceDatasetMaster
Inherits Component
Implements System.ComponentModel.IListSource
Public ReadOnly Property ContainsListCollection() As Boolean Implements
System.ComponentModel.IListSource.ContainsListCollection
Get
Return DirectCast(DatasetMaster.SingletonInstance,
System.ComponentModel.IListSource).ContainsListCollection
End Get
End Property
Public Function GetList() As System.Collections.IList Implements
System.ComponentModel.IListSource.GetList
Return DirectCast(DatasetMaster.SingletonInstance,
System.ComponentModel.IListSource).GetList()
End Function
End Class
In this way when I drag a ListSourceDatasetMaster from the toolbox into a
design surface, I get a desing time bindable object that always references
the same data. This data is the singleton instance of DatasetMaster.
Regards from Madrid (Spain)
Jesús López
VB MVP
<pax> escribió en el mensaje news:eMykBeEHGHA.1332@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view] >
> Hi, NG!
> Is there any way to share DataTable "definitions" across multiple DataSets
> in the DataSet designer? To make it more clear I need to have a "master"
> DataSet that contains unrelated tables (that are read-only at runtime,
> reference lists...) At runtime an instance of this DataSet will be
> globally
> accessible. Is it possible to access DataTables in this "master" DataSet
> from some other DataSets that have very different functionalities, but
> need
> to refer to some of these read-only lists?
> So, the needs are actually two: share DataTables between DataSets in the
> DataSet designer and second, at run-time, make DataTables in different
> DataSets access a single copy of data, i.e. the tables in a "master"
> object/DataSet.
>
> To make it even more clear there's a need for some read-only data across
> the
> entire application... and the ability to incorporate these tables in
> different scenarios/areas of the application, work with the
> relations/constraints in the designer... designer-aided databindings
> etc...
> The single DataSet per application solution would be quite messy...
>
> I guess this is a common need, but I cannot figure a way to implement
> it...
> I'm working with C# in VS 2005 Standard Edition.
>
> Any suggestion is very appreciate. Thanks in advance.
>
>
>
>
>
> pax
>
>
>
>