Link to home
Start Free TrialLog in
Avatar of jackjohnson44
jackjohnson44

asked on

combine datasets .net

I have a class that where I inherit a dataset and add methods to do operations on the dataset.  It is a datafacade on my cleint which talks to my webservice.  The dataset and the webservice are on the server.

So in my main application I reference the datafacade and don't have to worry if I change my webservice to a local instance or anything else, all I have to do is change the datafacade class.

my class
    class DataFacade : MyWebsevice.myDS

how I call it in code
        private DataFacade myDS_On_Client = new DataFacade();

I am working with a group and have problems checking out the dataset.  The datafacade is easy since I can use a partial class and don't have to worry if everyone gets their own partial class.

However I can't make a partial dataset.  Is there a way to somehow combine two datasets into one?
Avatar of jackjohnson44
jackjohnson44

ASKER

one more thing, I need the final dataset to be strongly typed.
dataset has merge method. use it as follows

maindataSet.Merge(childDataSet)


for more details
http://msdn2.microsoft.com/en-us/library/system.data.dataset.merge.aspx
That doesn't make is strongly typed though.

If my ds1 has a table Results
ds1.Results accesses the table

if ds2 has Tests
ds2.merge(ds1)

ds2.Tests does not exist

I need it to be strongly typed.
VS2005 supports partial classes on strongly typed datasets.
how do you do that?
Right click the DataSet.xsd file in the project and then select view code.
Thanks, but I think you missed the point.

I want to have a dataset that can be split into two files so each developer will have control over their own file, but still act as one dataset.  Like a partial class.  This is not for code, but for table definitions.
I see.  
MSDataSetGenerator is what makes the code files from the XSD schema file.  VS uses this custom tool (single file generator) by passing in the XSD file.

Running the MSDataSetGenerator on multiple files is not supported.

You may be able to create your own single file generator that would interface with Microsoft.VSDesigner.CodeGenerator.TypedDataSourceGenerator in mscoree.dll.  It would probably just run on another xml file that contained the names of the separate XSD datasets and a combined dataset name, then do XML processing to create a combined XSD file which you could then run MSDataSetGenerator on.  One downside will be the inability to create relationships between tables in separate XSD files.

Why do you need only 1 dataset?  Why not have 1 dataset per developer?
A source control solution could be used to handle versioning and multiple-checkouts if collaboration is the issue. (do not include the designer.vb file in source control)
I have a datafacade on my client.  It is a class that extends the dataset and also has the calls to the data access layer.

so this is how I create my class.
class DataFacade : MyWebsevice.myDS

If I have two datasets how will I access them through one class.

The reason the way I am doing it is good is because I can call

DataFacade myds ;
myds.tablename
myds.update

Since C# doesn't support multiple inheritance, how would I use two datasets, one for each developer?
You would need one datafacade class per dataset.
ASKER CERTIFIED SOLUTION
Avatar of RobertRFreeman
RobertRFreeman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial