This commit is contained in:
@@ -52,7 +52,10 @@ namespace AyaNova.DataList
|
||||
int returnRowColumnCount = dataListTableProcessingOptions.Columns.Count();
|
||||
List<List<DataListField>> rows = new List<List<DataListField>>();
|
||||
long totalRecordCount = 0;
|
||||
#if (DEBUG)
|
||||
System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
|
||||
|
||||
#endif
|
||||
//QUERY THE DB
|
||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||
{
|
||||
@@ -62,8 +65,16 @@ namespace AyaNova.DataList
|
||||
command.CommandText = qDataQuery;
|
||||
try
|
||||
{
|
||||
#if (DEBUG)
|
||||
stopWatch.Start();
|
||||
#endif
|
||||
using (var dr = await command.ExecuteReaderAsync())
|
||||
{
|
||||
#if (DEBUG)
|
||||
stopWatch.Stop();
|
||||
log.LogInformation($"(debug) DataListFetcher:GetResponse DATA query took {stopWatch.ElapsedMilliseconds}ms to execute: {qDataQuery}");
|
||||
stopWatch.Reset();
|
||||
#endif
|
||||
while (dr.Read())
|
||||
{
|
||||
List<DataListField> row = new List<DataListField>(returnRowColumnCount);
|
||||
@@ -72,9 +83,10 @@ namespace AyaNova.DataList
|
||||
{
|
||||
//get the AyaObjectFieldDefinition
|
||||
DataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
|
||||
if(f==null){
|
||||
|
||||
log.LogError($"DataListFetcher:GetResponseAsync Template field '{TemplateField}' was NOT found in the field definitions for data list {DataList.ToString()}");
|
||||
if (f == null)
|
||||
{
|
||||
|
||||
log.LogError($"DataListFetcher:GetResponseAsync Template field '{TemplateField}' was NOT found in the field definitions for data list {DataList.ToString()}");
|
||||
continue;
|
||||
}
|
||||
if (f.IsCustomField)
|
||||
@@ -148,8 +160,15 @@ namespace AyaNova.DataList
|
||||
|
||||
//GET TOTAL RECORD COUNT
|
||||
command.CommandText = qTotalRecordsQuery;
|
||||
#if (DEBUG)
|
||||
stopWatch.Start();
|
||||
#endif
|
||||
using (var dr = await command.ExecuteReaderAsync())
|
||||
{
|
||||
#if (DEBUG)
|
||||
stopWatch.Stop();
|
||||
log.LogInformation($"(debug) DataListFetcher:GetResponse COUNT query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}");
|
||||
#endif
|
||||
if (dr.Read())
|
||||
{
|
||||
totalRecordCount = dr.GetInt64(0);
|
||||
@@ -173,7 +192,8 @@ namespace AyaNova.DataList
|
||||
//log out the exception and the query
|
||||
log.LogError("DataListFetcher:GetResponseAsync unexpected failure. Data Query was:");
|
||||
log.LogError(qDataQuery);
|
||||
|
||||
log.LogError("Count Query was:");
|
||||
log.LogError(qTotalRecordsQuery);
|
||||
log.LogError(e, "Exception");
|
||||
throw new System.Exception("DataListFetcher:GetResponseAsync - unexpected failure see log");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user