我陷入了一些奇怪的问题。下面是代码 AccountsController.cs
// GET /api/accounts
[HttpGet]
[Queryable(ResultLimit = 50)]
public IQueryable<AccountDto> Get()
{
return this.service.Get();
}
服务在这里 - 这是AccountService.cs
public IQueryable<AccountDto> Get()
{
return this.readModel.Get();
}
和readModel的类型是AccountsReadModel的
public IQueryable<AccountDto> Get()
{
return Database.GetCollection<AccountDto>("Accounts").AsQueryable();
}
数据库被MongoDb.Driver.Database
问题如下: 当我试图查询Get方法不带任何参数 - localhost/api/accounts
- 它返回的所有帐户(意) 当我使用跳过:localhost/api/accounts?$skip=n
- 它跳过n,返回休息项目 (如预期太) 但是,localhost/api/accounts?$top=1
返回所有账户,而不是一个。
我该如何处理?