调用FOR XML存储过程的实体框架以2033个字符截断 [英] Entity framework calling a FOR XML stored procedure truncates at 2033 characters

查看:184
本文介绍了调用FOR XML存储过程的实体框架以2033个字符截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储过程,在其末尾使用FOR XML语句,并返回一些XML。



我正在使用.NET 4和实体框架,当我做这个存储过程的函数导入并尝试通过Entity框架调用它截断2033个字符的返回值。



我交换了传统ADO.NET方法的实体框架,以调用具有相同问题的存储过程 - 截断为2033个字符 - 这是当我遇到MSDN文章解释这是按设计,并使用ExecuteXMLReader方法来克服它:



http://support.microsoft.com/kb/310378



所以这是现在工作的一个临时修复,但我想使用Entity Framework函数导入,所以我没有ADO.NET代码与EF代码混合。



有没有办法我可以在EF中使用函数导入,返回XML并克服2033个字符的限制?



注意

bgs264

解决方案

今天遇到同样的问题。



EF函数调用返回2033长字符串中的XML 'chunks'(例如,如果你的XML是5000字符长,你会的接收3个结果:2033个字符中的2个,934个字符中的1个)



您可以轻松地附加这些块以返回完整的XML列表。


I have a stored procedure which uses a FOR XML statement at the end of it, and returns me some XML.

I am using .NET 4 and the Entity Framework and when I do a function import of this stored procedure and try to call it through the Entity Framework it truncates the return at 2033 characters.

I swapped the Entity Framework for a traditional ADO.NET approach to call the stored procedure which had the same problem - truncated at 2033 characters - which is when I came across the following MSDN article explaining this is by-design and to use the "ExecuteXMLReader" method to overcome it:

http://support.microsoft.com/kb/310378

So this is working now as a temporary fix but I'd like to use Entity Framework function imports so I've not got ADO.NET code mixed up with EF code.

Is there some way I can use function imports in EF, return the XML and overcome the 2033 character limit?

Regards
bgs264

解决方案

I ran into the same issue today.

The EF function call returns the XML in 2033-long string 'chunks' (e.g. if your XML was 5000 chars long you would receive 3 results: 2 of 2033 chars and 1 of 934 chars)

You can easily append these chunks to return a full list of the XML.

这篇关于调用FOR XML存储过程的实体框架以2033个字符截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆