Serializing data set with de-normalized data
- From: "Stephen Walch" <swalch@xxxxxxxxxxxxx>
- Date: Wed, 24 Aug 2005 06:09:56 -0400
I have a DataSet where some data items are actually objecy ot type string[].
If I output a schema using DataSet.WriteXmlSchema() using , I get:
<xs:element name="ItemName" msdata:DataType="System.String[], mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
type="xs:string" minOccurs="0" />
Accessong these items works fine in code:
//C#
string[] results = (string[])row["ItemName"];
But when I try to use the DataSet.WriteXml() method to serialize the data,
the output does not contain the desired data:
<CustomerID>System.String[]</CustomerID>
Clearly the serializer is calling the item value's ToString() method intread
of recognizing that it is a string array and digging deeper. I think I
understand why; the proper way to structure such a DataSet is to normalize
it such that "multi-valued" items are stored in a separate table with a data
relation.
Yet, I have to deal with the DataSet I have. Is there any option for
overriding how certain items are serialized and deserialized? Or am I stuck
with writng my own serializer from scratch?
.
- Follow-Ups:
- Re: Serializing data set with de-normalized data
- From: W.G. Ryan MVP
- Re: Serializing data set with de-normalized data
- Prev by Date: Other unnecessary primary leys are added to my dataset
- Next by Date: daMyDatatable.Update fails for linked dataset tables (using OleDb)
- Previous by thread: Other unnecessary primary leys are added to my dataset
- Next by thread: Re: Serializing data set with de-normalized data
- Index(es):
Relevant Pages
|