This commit is contained in:
2020-01-20 19:06:09 +00:00
parent 8d9fc80e68
commit c89a7bf681
4 changed files with 14 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ namespace AyaNova.Biz
public class AyaFieldData public class AyaFieldData
{ {
public object v { get; set; } public object v { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] //https://www.newtonsoft.com/json/help/html/JsonPropertyPropertyLevelSetting.htm
public long? Id { get; set; } public long? Id { get; set; }
} }
} }

View File

@@ -281,7 +281,7 @@ namespace AyaNova.Biz
//Accept a json template //Accept a json template
//return a column list suitable for api list return //return a column list suitable for api list return
public static string GenerateListColumnsJSONFromTemplate(AyaType defaultLinkType, List<AyaObjectFieldDefinition> objectFields, string template) public static string GenerateListColumnsJSONFromTemplate(AyaType defaultLinkType, List<AyaObjectFieldDefinition> objectFields, string template)
{ {
//parse the template //parse the template
var jtemplate = JObject.Parse(template); var jtemplate = JObject.Parse(template);
@@ -304,7 +304,7 @@ namespace AyaNova.Biz
//Developers little helper //Developers little helper
if (o == null) if (o == null)
{ {
throw new System.ArgumentNullException($"DEV ERROR in objectFields::GenerateListColumnsJSONFromTemplate - field {s} specified in template was NOT found in ObjectFields list for key \"{ObjectKey}\""); throw new System.ArgumentNullException($"DEV ERROR in objectFields::GenerateListColumnsJSONFromTemplate - field {s} specified in template was NOT found in ObjectFields list");
} }
#endif #endif

View File

@@ -13,7 +13,7 @@ namespace AyaNova.Biz
{ {
//Build the SELECT portion of a list query based on the template, mini or full and the object key in question //Build the SELECT portion of a list query based on the template, mini or full and the object key in question
public static string Build( List<AyaObjectFieldDefinition> objectFieldsList, string template, bool mini) public static string Build(List<AyaObjectFieldDefinition> objectFieldsList, string template, bool mini)
{ {
//parse the template //parse the template
@@ -38,7 +38,7 @@ namespace AyaNova.Biz
AyaObjectFieldDefinition def = objectFieldsList.FirstOrDefault(x => x.FieldKey == "df"); AyaObjectFieldDefinition def = objectFieldsList.FirstOrDefault(x => x.FieldKey == "df");
if (def == null) if (def == null)
{ {
throw new System.ArgumentNullException($"SqlSelectBuilder: objectFieldList for key \"{objectKey}\" is missing the df default field"); throw new System.ArgumentNullException("SqlSelectBuilder: objectFieldList is missing the df default field");
} }
if (string.IsNullOrEmpty(def.SqlIdColumnName)) if (string.IsNullOrEmpty(def.SqlIdColumnName))
{ {
@@ -58,7 +58,7 @@ namespace AyaNova.Biz
//Developers little helper //Developers little helper
if (o == null) if (o == null)
{ {
throw new System.ArgumentNullException($"DEV ERROR in SqlSelectBuilder.cs: field {ColumnName} specified in template was NOT found in ObjectFields list for key \"{objectKey}\""); throw new System.ArgumentNullException($"DEV ERROR in SqlSelectBuilder.cs: field {ColumnName} specified in template was NOT found in ObjectFields list");
} }
#endif #endif
if (o != null) if (o != null)

View File

@@ -468,7 +468,6 @@ namespace AyaNova.Biz
//RETURN OBJECTS //RETURN OBJECTS
//get the return row object count (number of items in each return row)
int returnRowCount = AyaObjectFields.Count(); int returnRowCount = AyaObjectFields.Count();
List<List<AyaFieldData>> rows = new List<List<AyaFieldData>>(); List<List<AyaFieldData>> rows = new List<List<AyaFieldData>>();
long totalRecordCount = 0; long totalRecordCount = 0;
@@ -478,6 +477,8 @@ namespace AyaNova.Biz
{ {
ct.Database.OpenConnection(); ct.Database.OpenConnection();
//GET DATA RETURN ROWS
command.CommandText = qDataQuery; command.CommandText = qDataQuery;
using (var dr = command.ExecuteReader()) using (var dr = command.ExecuteReader())
{ {
@@ -496,11 +497,11 @@ namespace AyaNova.Biz
d.Id = dr.GetInt64(dr.GetOrdinal(f.SqlIdColumnName)); d.Id = dr.GetInt64(dr.GetOrdinal(f.SqlIdColumnName));
} }
} }
rows.Add(row); rows.Add(row);
} }
} }
//GET TOTAL RECORD COUNT
command.CommandText = qTotalRecordsQuery; command.CommandText = qTotalRecordsQuery;
using (var dr = command.ExecuteReader()) using (var dr = command.ExecuteReader())
{ {
@@ -514,7 +515,7 @@ namespace AyaNova.Biz
//TODO: Build the return object in a clean format //TODO: Build the return object in a clean format
//I could just use a actual object class to return (object v {get;set;}) //I could just use a actual object class to return (object v {get;set;})
//with a optional ID that is set to json not serialize if null? //with a optional ID that is set to json not serialize if null?
//https://www.newtonsoft.com/json/help/html/JsonPropertyPropertyLevelSetting.htm