This commit is contained in:
@@ -13,7 +13,7 @@ namespace AyaNova.DataList
|
|||||||
internal abstract class AyaDataList : IAyaDataList
|
internal abstract class AyaDataList : IAyaDataList
|
||||||
{
|
{
|
||||||
|
|
||||||
internal AyaDataList()
|
public AyaDataList()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,20 +7,51 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
internal static class DataListFactory
|
internal static class DataListFactory
|
||||||
{
|
{
|
||||||
|
// internal static IAyaDataList GetAyaDataList(string ListKey)
|
||||||
|
// {
|
||||||
|
// switch (ListKey)
|
||||||
|
// {
|
||||||
|
// case nameof(TestWidgetUserEmailDataList):
|
||||||
|
// return new TestWidgetUserEmailDataList();
|
||||||
|
// case nameof(WidgetDataList):
|
||||||
|
// return new WidgetDataList();
|
||||||
|
// default:
|
||||||
|
// throw new System.ArgumentOutOfRangeException($"DataListFactory: Unknown list \"{ListKey}\"");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// internal static List<string> DataListList = null;
|
||||||
|
|
||||||
|
// private static void PopulateDataListList(){
|
||||||
|
// DataListList= new List<string>();
|
||||||
|
// foreach (System.Reflection.TypeInfo ti in ass.DefinedTypes)
|
||||||
|
// {
|
||||||
|
// if (ti.ImplementedInterfaces.Contains(typeof(IAyaDataList)))
|
||||||
|
// {
|
||||||
|
// DataListList.Add(ti.Name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//This may be fast enough to not cache but let's see
|
||||||
internal static IAyaDataList GetAyaDataList(string ListKey)
|
internal static IAyaDataList GetAyaDataList(string ListKey)
|
||||||
{
|
{
|
||||||
switch (ListKey)
|
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
|
||||||
{
|
|
||||||
case nameof(TestWidgetUserEmailDataList):
|
|
||||||
return new TestWidgetUserEmailDataList();
|
|
||||||
default:
|
|
||||||
throw new System.ArgumentOutOfRangeException($"DataListFactory: Unknown list \"{ListKey}\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
foreach (System.Reflection.TypeInfo ti in ass.DefinedTypes)
|
||||||
|
{
|
||||||
|
// if (!ti.IsAbstract && ti.ImplementedInterfaces.Contains(typeof(IAyaDataList)))
|
||||||
|
if(ti.Name==ListKey)
|
||||||
|
{
|
||||||
|
return ass.CreateInstance(ti.FullName) as IAyaDataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new System.ArgumentOutOfRangeException($"DEV ERROR in DataListFactory.cs: ListKey {ListKey} specified doesn't exist");
|
||||||
|
}
|
||||||
|
|
||||||
internal static List<string> GetListOfAllDataListKeyNames()
|
internal static List<string> GetListOfAllDataListKeyNames()
|
||||||
{
|
{
|
||||||
|
//https://stackoverflow.com/a/42574373/8939
|
||||||
|
|
||||||
List<string> ret = new List<string>();
|
List<string> ret = new List<string>();
|
||||||
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
|
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
|
||||||
@@ -33,7 +64,6 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace AyaNova.DataList
|
|||||||
|
|
||||||
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
|
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
|
||||||
FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition { LtKey = "df", AyaObjectType = (int)AyaType.Widget, SqlIdColumnName = "awidget.id" });
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.Widget, SqlIdColumnName = "awidget.id" });
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
{
|
||||||
LtKey = "WidgetName",
|
LtKey = "WidgetName",
|
||||||
|
|||||||
Reference in New Issue
Block a user