使用实体框架4时,我怎样才能返回一个DataReader? [英] How can I return a datareader when using Entity Framework 4?

查看:132
本文介绍了使用实体框架4时,我怎样才能返回一个DataReader?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我怎样才能做到这一点?这对于出口行至CSV。

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

欢呼声中,伊恩。

推荐答案

这个问题是各地EF 4,但对于其他人有EF 6或更高版本可以使用AsStreaming()扩展方法。

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

这篇关于使用实体框架4时,我怎样才能返回一个DataReader?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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