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