fixed slow customers and units list

This commit is contained in:
2021-10-14 22:30:26 +00:00
parent 1d7a71f17f
commit 40cb308fbb
2 changed files with 10 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
//#define AYSHOWQUERYINFO
using System.Collections.Generic;
using System.Linq;
using AyaNova.Biz;
@@ -12,6 +14,7 @@ namespace AyaNova.DataList
internal static class DataListFetcher
{
////////////////////////////////////////////////
// Get the data list data requested
//
@@ -52,7 +55,7 @@ namespace AyaNova.DataList
int returnRowColumnCount = dataListTableProcessingOptions.Columns.Count();
List<List<DataListField>> rows = new List<List<DataListField>>();
long totalRecordCount = 0;
#if (DEBUG)
#if (DEBUG && AYSHOWQUERYINFO)
System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
#endif
@@ -65,12 +68,12 @@ namespace AyaNova.DataList
command.CommandText = qDataQuery;
try
{
#if (DEBUG)
#if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Start();
#endif
using (var dr = await command.ExecuteReaderAsync())
{
#if (DEBUG)
#if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Stop();
log.LogInformation($"(debug) DataListFetcher:GetResponse DATA query took {stopWatch.ElapsedMilliseconds}ms to execute: {qDataQuery}");
stopWatch.Reset();
@@ -160,12 +163,12 @@ namespace AyaNova.DataList
//GET TOTAL RECORD COUNT
command.CommandText = qTotalRecordsQuery;
#if (DEBUG)
#if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Start();
#endif
using (var dr = await command.ExecuteReaderAsync())
{
#if (DEBUG)
#if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Stop();
log.LogInformation($"(debug) DataListFetcher:GetResponse COUNT query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}");
#endif