[英]Can I use LINQ to get more than 100 records back from a Quickbooks Online ServiceContext?
For my Quickbooks Online integration, I'm using the .NET SDK and was previously using LINQ to access data from a ServiceContext
: 对于我的Quickbooks Online集成,我使用.NET SDK,并且以前使用LINQ从
ServiceContext
访问数据:
var paymentMethodsService = new QueryService<PaymentMethod>(ServiceContext);
_paymentMethods = paymentMethodsService.Select(x => x).ToList();
When testing, we noticed that this only returns the first 100 records. 在测试时,我们注意到这仅返回前100条记录。 (Presumably because this is the default page size?)
(大概是因为这是默认页面大小?)
We can get around this by using a query containing MAXRESULTS
: 我们可以通过使用包含
MAXRESULTS
的查询来解决此MAXRESULTS
:
var itemsService = new QueryService<Item>(ServiceContext);
_items = itemsService.ExecuteIdsQuery("SELECT * FROM Item MAXRESULTS 1000").ToList();
My question is, can I achieve the same result without using a query string? 我的问题是,不使用查询字符串就可以达到相同的结果吗?
I must admit I have no idea what Quickbooks Online even is, but nevertheless I think you can override default page size with LINQ Take(yourPageSize)
. 我必须承认,我什至不知道什么是Quickbooks Online,但是我认为您可以使用LINQ
Take(yourPageSize)
覆盖默认页面大小。 Though it's still not clear how to fetch ALL items in a collection this way, without knowing total count beforehand. 尽管目前尚不清楚如何以这种方式获取集合中的所有项目,而无需事先知道总数。 Hopefully you don't need to do this in your scenario (or if you do - maybe you can just use arbitrary large number for
Take
if you won't find another way). 希望您在您的场景中不需要这样做(或者,如果您这样做-如果您找不到其他方法,也许可以对
Take
使用任意大的数字)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.