This commit is contained in:
2020-02-15 00:17:09 +00:00
parent 2319c22745
commit 0b5d548d91
4 changed files with 74 additions and 19 deletions

View File

@@ -104,27 +104,52 @@ namespace AyaNova.DataList
//GetOrdinal by name is flakey in npgsql so just going by field definition and ordinal numerically
int nCurrentColumnPointer = 1;//start at 1
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
// dr.GetOrdinal();
// dr.GetName();
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
foreach (string TemplateField in ListViewFieldList)
{
if (TemplateField == "df")
continue;
//get the AyaObjectFieldDefinition
AyaDataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(x => x.FieldKey == TemplateField);
AyaFieldData AyaField = new AyaFieldData();
AyaField.v = dr.GetValue(nCurrentColumnPointer);
nCurrentColumnPointer++;
if (f.SqlIdColumnName != null)//skip over df column id, it's not there
if (f.IsCustomField)
{
if (!await dr.IsDBNullAsync(nCurrentColumnPointer))
AyaField.i = dr.GetInt64(nCurrentColumnPointer);
var v=dr;
/*
TODO: Custom field handling
GetName works just not with multipart identifiers
I could force naming by making all fields and AS, or
I could map the ordinal when generating the Select fields so that I have a map to refer to here
mapping in advance actually makes a lot of sense, then no more of this fragility of going by pointer index and hoping for the best
it would just be premapped out.
dr.GetOrdinal(f.SqlValueColumnName)
'dr.GetOrdinal(f.SqlValueColumnName)' threw an exception of type 'System.IndexOutOfRangeException'
f.SqlValueColumnName
"awidget.customfields"
dr.GetName(nCurrentColumnPointer)
"customfields"
dr.GetOrdinal("customfields");
5
nCurrentColumnPointer++;
*/
}
else
{
AyaFieldData AyaField = new AyaFieldData();
AyaField.v = dr.GetValue(nCurrentColumnPointer);
nCurrentColumnPointer++;
if (f.SqlIdColumnName != null)//skip over df column id, it's not there
{
if (!await dr.IsDBNullAsync(nCurrentColumnPointer))
AyaField.i = dr.GetInt64(nCurrentColumnPointer);
nCurrentColumnPointer++;
}
row.Add(AyaField);
}
row.Add(AyaField);
}
rows.Add(row);
}