Skip to content

Commit c378508

Browse files
committed
Open for default pagesize !=5000. Fixed #1084
1 parent 3f9a391 commit c378508

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

FetchXmlBuilder/AppCode/QueryInfo.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public QueryBase Query
3131
{
3232
if (fetch.Query.ToXml().SelectSingleNode("fetch") is XmlElement fetchnode)
3333
{
34-
PageSize = Math.Min(fetchnode.AttributeInt("count") ?? 5000, 5000);
34+
PageSize = Math.Min(fetchnode.AttributeInt("count") ?? 0, 5000);
3535
PageNo = fetchnode.AttributeInt("page") ?? 1;
3636
}
3737
}
@@ -52,6 +52,17 @@ public EntityCollection Results
5252
PageNo = page;
5353
}
5454
}
55+
if (PageSize == 0)
56+
{
57+
if (result.MoreRecords)
58+
{
59+
PageSize = result.Entities.Count;
60+
}
61+
else
62+
{
63+
PageSize = 5000;
64+
}
65+
}
5566
if (result.TotalRecordCount > -1 && result.TotalRecordCount < 5000 && PageSize > 0 && result.TotalRecordCount > PageSize)
5667
{
5768
Pages = (int)Math.Ceiling((decimal)result.TotalRecordCount / PageSize);

0 commit comments

Comments
 (0)