[英]NAV Web Services getting data in chunks using C#
I am a bit new to NAV and so far I have published web services on NAV and have been able to consume these SOAP web services using C#. 我对NAV有点陌生,到目前为止,我已经在NAV上发布了Web服务,并且能够使用C#来使用这些SOAP Web服务。
Now, the data has increased and its taking longer to load. 现在,数据已经增加,并且加载时间更长。 I have an idea of querying the data in chunks (eg chunks of 10) using Datatables , but this I am yet too figure out how to set limits and offsets.
我有一个使用Datatables查询数据块(例如10个数据块)的想法,但是我仍然想知道如何设置限制和偏移量。
Here is my C# code to read the NAV soap service 这是我的C#代码以阅读NAV肥皂服务
public string getItemCardList(itemCardService_Service itemCardServiceObj, List<itemCardService_Filter> filter)
{
serializer.MaxJsonLength = 50000000;
return serializer.Serialize(itemCardServiceObj.ReadMultiple(filter.ToArray(), null, 0));
}
After some several searches I have gotten the answer on the [MSDN Website][ https://msdn.microsoft.com/en-us/library/ff477110.aspx] and modified it to work for me. 经过几次搜索后,我在[MSDN网站] [ https://msdn.microsoft.com/en-us/library/ff477110.aspx]上得到了答案,并对其进行了修改以使其适合我。
public string holder()
{
const int fetchSize = 10;
string bookmarkKey = null;
List<itemCardService> itemList = new List<itemCardService>();
//Read items data in pages of 10
itemCardService[] results = itemCardServiceObj.ReadMultiple(filter.ToArray(), bookmarkKey, fetchSize);
while(results.Length > 0)
{
bookmarkKey = results.Last().Key;
itemList.AddRange(results);
results = itemCardServiceObj.ReadMultiple(filter.ToArray(), bookmarkKey, fetchSize);
}
serializer.MaxJsonLength = 50000000;
return serializer.Serialize(itemList);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.