DataSet serialization

V

Viorel Ghilas

Hi all,

I have my own classes that derives from DataTable,
Ex.
[Serializable]
public class MyTable1 : DataTable {
public MyTable1() : base { ... }
public MyTable1(SerializationInfo info, StreamingContext context) :
base(info, context) {}
}

My business layer create and fill the table and add it to the DataSet obectr
and send serialiazed to the client via remouting, on the UI side when I get
the table the type is simple DataTable, why ? How to serialized and
desirizlized the typed DataTable, I want to get typed DaTable

with best regards
Viorel ghilas
 
B

Brian Noyes

Just construct an instance of your typed data set on the client, and use the
Merge method to pull in the data from the generic data set returned by the
remoting method. As long as the schemas match it should pull the data in to
populate the typed instance fine:

DataSet ds = myRemotingObject.GetDataSet();
MyTypedDataSet tds = new MyTypedDataSet();
tds.Merge(ds);

Hope that helps,
Brian
 
V

Viorel Ghilas

Hi Brian

Thanks, I used your technique and it's work. But could you explain why
DataSet doesn't desirilize typed datatables.

with best regrds
Viorel Ghilas

Brian Noyes said:
Just construct an instance of your typed data set on the client, and use the
Merge method to pull in the data from the generic data set returned by the
remoting method. As long as the schemas match it should pull the data in to
populate the typed instance fine:

DataSet ds = myRemotingObject.GetDataSet();
MyTypedDataSet tds = new MyTypedDataSet();
tds.Merge(ds);

Hope that helps,
Brian

Viorel Ghilas said:
Hi all,

I have my own classes that derives from DataTable,
Ex.
[Serializable]
public class MyTable1 : DataTable {
public MyTable1() : base { ... }
public MyTable1(SerializationInfo info, StreamingContext context) :
base(info, context) {}
}

My business layer create and fill the table and add it to the DataSet obectr
and send serialiazed to the client via remouting, on the UI side when I get
the table the type is simple DataTable, why ? How to serialized and
desirizlized the typed DataTable, I want to get typed DaTable

with best regards
Viorel ghilas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top