DataSet serialization

  • Thread starter Thread starter Viorel Ghilas
  • Start date Start date
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
 
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
 
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
 
Back
Top