I have these entities that are being called at runtime and I need to be able to return an IQueryable<EntityObject>
based on the entity type being called that particular time by string. Let's say the entity is types of food and the class name is Food
, so...
return Repository.Read<Food>(); //this is what I am trying to accomplish
However, I don't know that it is Food
until runtime and is such only given as a string, so I use reflection:
Type t = Type.GetType(lookupEntityName); //where lookupEntityName = "Food"
How can I use this Type t
to replace 'Food' in the original line of code from above:
return Repository.Read<HERE>(); // use 't' to repalce "HERE"
Aucun commentaire:
Enregistrer un commentaire