Entity Framework 6.1本机是否支持XML数据类型?

时间:2023-01-16 16:30:04

Some RDBMSs (including SQL Server) support XML columns. I'd prefer not mapping such a column to the string data type. Does Entity Framework 6.1 support XML natively in any way?

一些RDBMS(包括SQL Server)支持XML列。我不希望不将这样的列映射到字符串数据类型。 Entity Framework 6.1是否以任何方式本机支持XML?

More specifically, can I map an xml column to one of the XML data types of .NET (such as XElement or XmlElement)? Does Entity Framework support XQuery that is integrated into normal LINQ queries and is translated to SQL queries?

更具体地说,我可以将xml列映射到.NET的XML数据类型之一(例如XElement或XmlElement)吗? Entity Framework是否支持集成到普通LINQ查询中并转换为SQL查询的XQuery?

1 个解决方案

#1


16  

No, only mapping it to string and then having to stream it back in to an XML document.

不,只将其映射到字符串,然后将其重新流回XML文档。

There is a long thread back and forth with Microsoft about doing this in EF4, 5, or 6, but it looks like they researched it and decided to punt.

微软在EF4,5或6中做了一个很长的线程,但看起来他们研究了它并决定试图解决它。

You can read that here:

你可以在这里阅读:

https://social.msdn.microsoft.com/Forums/en-US/fb290076-f97d-41f4-9801-505ccf5ef1d6/entity-framework-and-sql-xml-data-type?forum=adodotnetentityframework

https://social.msdn.microsoft.com/Forums/en-US/fb290076-f97d-41f4-9801-505ccf5ef1d6/entity-framework-and-sql-xml-data-type?forum=adodotnetentityframework

#1


16  

No, only mapping it to string and then having to stream it back in to an XML document.

不,只将其映射到字符串,然后将其重新流回XML文档。

There is a long thread back and forth with Microsoft about doing this in EF4, 5, or 6, but it looks like they researched it and decided to punt.

微软在EF4,5或6中做了一个很长的线程,但看起来他们研究了它并决定试图解决它。

You can read that here:

你可以在这里阅读:

https://social.msdn.microsoft.com/Forums/en-US/fb290076-f97d-41f4-9801-505ccf5ef1d6/entity-framework-and-sql-xml-data-type?forum=adodotnetentityframework

https://social.msdn.microsoft.com/Forums/en-US/fb290076-f97d-41f4-9801-505ccf5ef1d6/entity-framework-and-sql-xml-data-type?forum=adodotnetentityframework