In LinqPad, is there a way to serialize type XML column as string?

泄露秘密 提交于 2019-12-10 18:25:35

问题


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 strings instead of XElements. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!