评估SQLQ查询到LINQ对象 - C#

时间:2021-07-30 15:46:25

I have a dynamic SQL string which I want to evaluate and return as a LINQ-object.

我有一个动态SQL字符串,我想评估它并作为LINQ对象返回。

Is there any easy way to do this in C#? Have tried googleing it, but haven't found anything.. So all(or most) answers are appreciated.

有没有简单的方法在C#中做到这一点?尝试过谷歌,但没有发现任何东西..所以(或大多数)答案都很受欢迎。

Best Regards, Robin

最诚挚的问候,罗宾

1 个解决方案

#1


I found it:

我找到了:

IEnumerable<XElement> linq;
linq = (IEnumerable<XElement>)XElement.Parse(RawXmlData.ToString()).Elements();

#1


I found it:

我找到了:

IEnumerable<XElement> linq;
linq = (IEnumerable<XElement>)XElement.Parse(RawXmlData.ToString()).Elements();