相当于TOP或LIMIT/OFFSET的Linq to SQL是什么? [英] What's the Linq to SQL equivalent to TOP or LIMIT/OFFSET?
本文介绍了相当于TOP或LIMIT/OFFSET的Linq to SQL是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我该怎么做
Select top 10 Foo from MyTable
在Linq to SQL中?
in Linq to SQL?
推荐答案
在VB中:
from m in MyTable
take 10
select m.Foo
这假定MyTable实现IQueryable.您可能必须通过DataContext或其他提供程序来访问它.
This assumes that MyTable implements IQueryable. You may have to access that through a DataContext or some other provider.
它还假定Foo是MyTable中的一列,该列已映射到属性名称.
It also assumes that Foo is a column in MyTable that gets mapped to a property name.
See http://blogs.msdn.com/vbteam/archive/2008/01/08/converting-sql-to-linq-part-7-union-top-subqueries-bill-horst.aspx for more detail.
这篇关于相当于TOP或LIMIT/OFFSET的Linq to SQL是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文