如何使用linq to sql将xml文件存储在xml列中?

时间:2022-10-17 14:51:00

I have xml files I want to read in and store in the database. Linq to sql requires the data to be sent in using an xelement, but if I send in the data this

我有想要读入的xml文件并存储在数据库中。 Linq to sql要求使用xelement发送数据,但是如果我发送数据这个

new XElement("build", BuildNode.InnerXml)

I end up with data looking like this in the database lt;..gt;.. It converts the brackets into lt; and gt; which then makes the data useless from a xml standpoint.

我最终在数据库中看起来像这样的数据lt; .. gt; ..它将括号转换为lt;和gt;然后从xml的角度来看数据无用。

Any ideas on how to get the xml data inside the xml column?

有关如何在xml列中获取xml数据的任何想法?

1 个解决方案

#1


2  

Looks like you should use XElement.Parse(BuildNode.InnerXml) instead of just passing the raw property in.

看起来你应该使用XElement.Parse(BuildNode.InnerXml)而不是仅仅传递原始属性。

RE: http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/413654f3-dc2d-4b96-8a7e-bde69da05866/

#1


2  

Looks like you should use XElement.Parse(BuildNode.InnerXml) instead of just passing the raw property in.

看起来你应该使用XElement.Parse(BuildNode.InnerXml)而不是仅仅传递原始属性。

RE: http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/413654f3-dc2d-4b96-8a7e-bde69da05866/