I need a solution for loading lists of objects - search queries in which only one property refers to the current object, as in this example.
class LookupObjectAddress { [...] public string City { get; set; } [...] } class WorkingObject {
To search, I need a List that needs to be downloaded from the database, to find out where to download information, I use the attribute
class WorkingObject {
After reading PropertyInfo for the WorkingObject.City property, I know the type of the search object and from which class, with which method to load it. Now I need a bridge to get a list with three parameters to work with.
Type loaderClass = Type.GetType(classname); MethodInfo loaderMethod = loaderClass.GetMethod(loadmethod); object objList = loaderMethod.Invoke(null, new object[] {});
Since I need a typed List <> to use the LookupObjects properties in the user interface, how can I become a useful list in Code?
My ideal result would be if I could just type:
var list = Loader.Load(type, "LookupObjLoader", "LookupObjLoadMethod");
where the parameters are read from the attribute.
source share