title: DataSet Serialization Problem in .Net
body: <p>I have a dataset containing several tables, which is populated from a stored procedure. I want to make it nested for the GetXml() method.</p>
  
  <p>I added the relation:</p>
  
  <pre><code>set.Relations.Add(
      new DataRelation("Author_Document",
          new DataColumn[] { set.Tables["Author"].Columns["lngDocumentSeriesId"], set.Tables["Author"].Columns["strAuthorName"] },
          new DataColumn[] { set.Tables["Document"].Columns["lngDocumentSeriesId"], set.Tables["Document"].Columns["strAuthorName"] }, true));
  </code></pre>
  
  <p>I made it nested:</p>
  
  <pre><code>foreach (DataRelation relation in set.Relations)
  {
      relation.Nested = true;
  }
  </code></pre>
  
  <p>And enforced:</p>
  
  <pre><code>set.EnforceConstraints = true;
  </code></pre>
  
  <p>All of which run fine, with no errors. The problem is when I call <code>set.GetXml()</code>, which throws a DataException: "<em>Cannot proceed with serializing DataTable 'Document'. It contains a DataRow which has multiple parent rows on the same Foreign Key</em>".</p>
  
  <p>Upon inspection, the tables in question have each just a single row. The columns lngDocumentSeriesId and strAuthorName match. Even if there were a data integrety problem, it should have caused the exception on the <code>set.EnforceConstraints = true;</code> line, as I understand it.</p>
  
  <p>What could cause this error (when all tables have just a single row), and how can it be fixed?</p>