Hello,
I have no idea how to get my hierarchical dataset filled by a remoting service. Please imagine the following Typed Dataset called BookDataset:
Authors table
----
authorid
name
Books table
----
bookid
authorid (fk)
title
For simplicity reasons, a book is always written by one author, but one author wrote several books. There are existing Constraints and a (nested) relation between the Tables.
I have two functions in my Remoting Object, to fill the Authors, and to fill the Books by author:
BookDataset FillAuthors(BookDataset.AuthorsDataTable target); BookDataset FillBooksByAuthor(BookDataset.BooksDataTable target, int bookid); |
The first part is simple: I Want to get the Books list:
BookDataset myBookDataset = new BookDataset(); myBookDataset = myRemotingInterface.FillAuthors(myBookDataset.Authors); |
then i want to get the Book of any author:
int authorid = 6; myBookDataset = myRemotingInterface.FillBooksByAuthor(myBookDataset.Books, authorid); |
Locally, this wouldn't be a problem because of passing only the reference to the Dataset. But when Remoting, now there is the Problem, that i'm passing around the whole dataset over the network/internet.
Is that right
If yes, i guess thats a very bad idea.
My second approach, to just fill the tables, not the whole dataset, was not working:
Here are the modified functions:
BookDataset.AuthorsDataTable GetAuthors(); BookDataset.BooksDataTable GetBooksByAuthor(int bookid); |
But now, i am unable to retrieve a single table, because the Table properties are read-only:
BookDataset myBookDataset = new BookDataset(); myBookDataset.AuthorsDataTable = myRemotingInterface.GetAuthors(); |
This code will fail because myBookDataset.AuthorsDataTable is Read-only.
My Question is:
What would be the right approach to work with the typed Dataset
I would like to keep all constraints and nested relations.
I dont want to pass around the whole Object because it might grow very quickly.
How can i receive a single Table of a Dataset from a Remoting Object and integrate it to the whole DataSet
The only method i knew was using a DataAdapter and the Fill() function, but obviously i dont have (and dont need ) such a construct here
Your help is very appreciated!

.NET 2.0 b2 Remoting and filling a hierarchical dataset?
semilogic
I made some progress while working around with the problem, so here is my current status:
I reduced a lot of transfer by returning only the Tables, not the whole Dataset. To get this working, i found the Method DataTable.Merge(DataTable dt) very useful: When the original dataset is existing on the client, the Merge Method will keep all existing constraints and nested relations.
When i expect a whole Dataset to be returned, i can use DataSet.Merge(DataSet ds) to complete my existing Datasets, which is working better then i assumed to work.
This seems to be a good solution to my problem!
Mike VB
Nick Davidson
I am going to move this over to the data forums.