简体   繁体   English

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

[英]How to store xml files in an xml column using linq to sql?

I have xml files I want to read in and store in the database.我有我想读入并存储在数据库中的 xml 文件。 Linq to sql requires the data to be sent in using an xelement, but if I send in the data this 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;我最终得到的数据在数据库 lt;..gt;.. 中看起来像这样。它将括号转换为 lt; and gt;和 gt; which then makes the data useless from a xml standpoint.从 xml 的角度来看,这会使数据变得无用。

Any ideas on how to get the xml data inside the xml column?关于如何在 xml 列中获取 xml 数据的任何想法?

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/回复: http : //social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/413654f3-dc2d-4b96-8a7e-bde69da05866/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM