Serializing data set with de-normalized data



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?


.



Relevant Pages

  • Xml serialization
    ... XmlSerializer serializer = new XmlSerializer); ... at System.Reflection.Assembly.nLoad(AssemblyName fileName, String ... assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, ... Policy not being applied to reference at this time (private, custom, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: DeSerializing an object
    ... remove it till you get your serializer working. ... string is not right. ... XmlSerializer ser = new XmlSerializer); ... public string Value; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Deserializing an inherited class
    ... Public Function DeserializeXML(ByVal sXML As String) As Object ... Dim serializer As XmlSerializer = New ... Dim sr As StringReader = New StringReader ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Convert.FromBase64String() and ViewState
    ... into Base64 string. ... If on postback I issue the following code: ... Why are you looking at the viewstate in this manner? ... That depends on which serializer ASP.NET chooses. ...
    (microsoft.public.dotnet.languages.csharp)
  • Serializing and Deserializing Value Types to String
    ... serializing and deserializing these to string format. ... thought that if there was a true serializer, deserializer, that would be ... An example would be the way that a DateTime column in a DataTable is ... serialized to XML. ...
    (microsoft.public.dotnet.languages.csharp)