PFr*_*ise 16 c# sql entity-framework
这是一个简单的问题(我认为),但我找不到解决方案.我知道对于其他类型的查询,您可以添加一个限制子句,使查询只返回那么多结果.这可能是实体查询吗?
var productQuery = from b in solutionContext.Version
where b.Product.ID != 1 && b.VersionNumber == b.Product.ActiveNumber
orderby b.Product.LastNumber
select b;
Run Code Online (Sandbox Code Playgroud)
我只是想这样做,所以这个查询只返回25个版本对象.谢谢你的帮助.
Łuk*_*.pl 42
确定..例如你可以这样做:
var productQuery = from b in solutionContext.Version
where b.Product.ID != 1 && b.VersionNumber == b.Product.ActiveNumber
orderby b.Product.LastNumber
select b;
var limitedProductQuery = productQuery.Take(25);
Run Code Online (Sandbox Code Playgroud)
您也可能需要这个来进行分页结果:
var pagedProductQuery = productQuery.Skip(25 * page).Take(25)
Run Code Online (Sandbox Code Playgroud)
什么你要找的是采取:
var productQuery = (from b in solutionContext.Version
where b.Product.ID != 1
&& b.VersionNumber == b.Product.ActiveNumber
orderby b.Product.LastNumber
select b).Take(25);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28711 次 |
| 最近记录: |