问题
I have a XML column on SQL. And there are malformed data exist in it. Which causes the error "There are multiple root elements." when I run MyTable.Take(4).Dump();
e.g.
<cy>
<n>NameA</n>
<p>true</p>
</cy>
<cy>
<n>NameB</n>
<p>false</p>
</cy>
Is there a way to tell LinQPad to not serialize XML column and provide it as a string?
Unfortunately data is tied up with many places so I can not wrap it with root element on database right away.
回答1:
The latest LINQPad beta, version 5.10.06, allows you to access the XML columns as strings:
NEW/IMPROVED:
There's a new checkbox in the SQL advanced connection properties dialog to map XML columns to .NET
string
s instead ofXElement
s. This allows you to query tables with malformed XML without error.
来源:https://stackoverflow.com/questions/40089784/in-linqpad-is-there-a-way-to-serialize-type-xml-column-as-string