简体   繁体   English

EntityFramework和XML

[英]EntityFramework and XML

We have a application that is making requests to a MSSQL DB via Entity Framework. 我们有一个通过实体框架向MSSQL DB发出请求的应用程序。 One column in one table is a serialized C# class, stored in XML format. 一个表中的一列是以XML格式存储的序列化C#类。 We would like to perform simple XPath queries against this data from C#. 我们想对来自C#的数据执行简单的XPath查询。 Currently we simply load the dataset, parse the XML via linq-to-XML then query the structure. 当前,我们只加载数据集,通过linq-to-XML解析XML,然后查询结构。 This is of course the absolute worst way to solve this problem, so I'm looking for alternatives. 当然,这绝对是解决该问题的绝对最糟糕的方法,因此我正在寻找替代方法。

MS SQL 2008 can query XML data, so how do I do that through EF? MS SQL 2008可以查询XML数据,那么如何通过EF进行查询呢?

You can use a stored procedure. 您可以使用存储过程。 Or you can run dynamic SQL using ObjectQuery. 或者,您可以使用ObjectQuery运行动态SQL。 Other than that, I don't know of any way to use the XML features of SQL Server through EF. 除此之外,我不知道通过EF使用SQL Server的XML功能的任何方法。

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

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