This commit is contained in:
@@ -25,22 +25,23 @@ namespace AyaNova.DataList
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("SELECT ");
|
||||
|
||||
//Default ID column for each row (always is aliased as df)
|
||||
AyaDataListFieldDefinition def = objectFieldsList.FirstOrDefault(x => x.FieldKey == "df");
|
||||
if (def == null)
|
||||
{
|
||||
throw new System.ArgumentNullException("DataListSqlSelectBuilder: objectFieldList is missing the df default field");
|
||||
}
|
||||
if (string.IsNullOrEmpty(def.SqlIdColumnName))
|
||||
{
|
||||
sb.Append("id");//default when no alternate column is specified
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(def.SqlIdColumnName);
|
||||
}
|
||||
//DEPRECATED
|
||||
// //Default ID column for each row (always is aliased as df)
|
||||
// AyaDataListFieldDefinition def = objectFieldsList.FirstOrDefault(x => x.FieldKey == "df");
|
||||
// if (def == null)
|
||||
// {
|
||||
// throw new System.ArgumentNullException("DataListSqlSelectBuilder: objectFieldList is missing the df default field");
|
||||
// }
|
||||
// if (string.IsNullOrEmpty(def.SqlIdColumnName))
|
||||
// {
|
||||
// sb.Append("id");//default when no alternate column is specified
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sb.Append(def.SqlIdColumnName);
|
||||
// }
|
||||
|
||||
sb.Append(" AS df");
|
||||
// sb.Append(" AS df");
|
||||
|
||||
//keep track of which custom fields columns were added already
|
||||
//this ensures that if there is more than one set of custom fields like from two different objects in the list
|
||||
@@ -49,13 +50,15 @@ namespace AyaNova.DataList
|
||||
//map sql column name to ordinal name
|
||||
Dictionary<string, int> map = new Dictionary<string, int>();
|
||||
|
||||
map.Add("df", 0);
|
||||
//DEPRECATED map.Add("df", 0);
|
||||
int nOrdinal = 0;
|
||||
|
||||
|
||||
foreach (string ColumnName in listViewFieldList)
|
||||
{
|
||||
//skip the df column, it's already been processed above
|
||||
if (ColumnName == "df")
|
||||
continue;
|
||||
// //skip the df column, it's already been processed above
|
||||
// if (ColumnName == "df")
|
||||
// continue;
|
||||
AyaDataListFieldDefinition o = objectFieldsList.FirstOrDefault(x => x.FieldKey == ColumnName);
|
||||
#if (DEBUG)
|
||||
//Developers little helper
|
||||
@@ -76,7 +79,7 @@ namespace AyaNova.DataList
|
||||
{ //nope
|
||||
sb.Append(", ");
|
||||
sb.Append(CustomFieldSqlColumnName);
|
||||
map.Add(CustomFieldSqlColumnName, ++nOrdinal);
|
||||
map.Add(CustomFieldSqlColumnName, nOrdinal++);
|
||||
}
|
||||
//if it was already added then can just ignore it
|
||||
// else
|
||||
@@ -106,6 +109,7 @@ namespace AyaNova.DataList
|
||||
map.Add(idColumnName, ++nOrdinal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user