如何将实体数据模型中的所有记录都获取到数据集 [英] How to get all records from Entity data model to Dataset

查看:165
本文介绍了如何将实体数据模型中的所有记录都获取到数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



如何使用Entity Framework将视图或表格中的所有记录检索到数据集。



请回复。

提前谢谢。

Hi All,

How can I retrive all the records present in a view or table to a dataset using Entity Framework.

Please respond.
Thanks in advance.

推荐答案

你需要拿一本关于实体框架的书。



你没有让EF给你一个DataTable。它也不能与数据库视图一起使用而不将它们混合在一起。



EF返回附加到DbContext的DbSet中的数据。您无法指定自定义查询并以任何方式返回给您。



如果您想要数据表中的数据,您将拥有编写代码来自己构建数据表并从DbSet返回的数据中填充它。
You need to pick up a book on Entity Framework.

You don't get EF to give you a DataTable. It also doesn't work with a database view without hacking it together.

EF returns data in a DbSet attached to your DbContext. You Don't get to specify a custom query and have it returned to you any way you want.

If You want the data in a datatable, you'll have write the code to build the datatable yourself and populate it from the data returned by the DbSet.


这篇关于如何将实体数据模型中的所有记录都获取到数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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