使用Entity Framework 4时如何返回datareader? [英] How can I return a datareader when using Entity Framework 4?

查看:140
本文介绍了使用Entity Framework 4时如何返回datareader?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用LINQ和我的EntityFramework上下文定义一个数据库查询,但是我不想返回实体;我想要一个datareader!



我该怎么做?这是用于将行导出为CSV。



干杯,Ian。

解决方案

这个问题在EF 4左右,但对于任何具有EF 6或更高版本的人,您都可以使用AsStreaming()扩展方法。




I want to define a database query using LINQ and my EntityFramework context but I don't want entities returned; I want a datareader!

How can I do this? This is for exporting rows to a CSV.

Cheers, Ian.

解决方案

This question is around EF 4, but for anyone else with EF 6 or higher you can use the AsStreaming() extension method.

http://msdn.microsoft.com/en-us/library/dn237204(v=vs.113).aspx

这篇关于使用Entity Framework 4时如何返回datareader?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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