This commit is contained in:
40
server/AyaNova/PickList/PickListFactory.cs
Normal file
40
server/AyaNova/PickList/PickListFactory.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AyaNova.Biz;
|
||||
|
||||
|
||||
namespace AyaNova.PickList
|
||||
{
|
||||
internal static class PickListFactory
|
||||
{
|
||||
|
||||
//Instantiate list object specified from type
|
||||
internal static IAyaPickList GetAyaPickList(AyaType ayaType)
|
||||
{
|
||||
switch(ayaType){
|
||||
case AyaType.Widget:
|
||||
return new WidgetPickList() as IAyaDataList;
|
||||
}
|
||||
}
|
||||
|
||||
//List all the datalist types available
|
||||
internal static List<string> GetListOfAllPickListKeyNames()
|
||||
{
|
||||
//https://stackoverflow.com/a/42574373/8939
|
||||
|
||||
List<string> ret = new List<string>();
|
||||
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
|
||||
|
||||
foreach (System.Reflection.TypeInfo ti in ass.DefinedTypes)
|
||||
{
|
||||
if (!ti.IsAbstract && ti.ImplementedInterfaces.Contains(typeof(IAyaPickList)))
|
||||
{
|
||||
ret.Add(ti.Name);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user