【发布时间】:2020-07-15 05:04:06
【问题描述】:
我正在使用 Microsoft oData 客户端从第三方 API 检索用户信息。我有以下代码。
var query = Context.Users.Where(x => x.username.EndsWith("10"));
var result = query.ToList().Select(x => x.username);
但是,这只会返回 100 条记录。我可以使用下面的代码来检索所有没有条件的记录;
DataServiceCollection<User> users = new DataServiceCollection<User>(
Context.Users
);
while (users.Continuation != null)
{
//use the token to query for more users
//and load the results back into the collection
users.Load(
Context.Execute<User>(users.Continuation)
);
//print the current count of users retrieved
Console.WriteLine(users.Count);
}
如何将两者结合起来?即检索条件为 (x.username.EndsWith("10")) 的所有记录。
【问题讨论】: