使用实体框架从表中获取前10个值

问题描述:



我正在研究实体框架.如何使用实体框架从表中获取前10个值?我只需要查询.我已经用谷歌搜索了很多,但是没有得到确切的结果.

在此先感谢.

Hi,

I am studying the entity framework. How can I get the first 10 values from a table using entity framework? I need the query only. I already googled it a lot but I didn''t get an exact result.

Thanks in advance.

如果您从2005年开始使用SQL Server,请执行以下操作:
SELECT TOP 10 ...


在var list中设置列表后,
If you''re using SQL Server from 2005 upward do something like:
SELECT TOP 10 ...


//after you set up your list in var list = ... do this:
list = list.Take(10);



那应该给你10行.

问候,

曼弗雷德(Manfred)



That should give you your 10 rows.

Regards,

Manfred