if I have the following classes:
class Fruit {}
class Apple : Fruit {}
class Orange : Fruit {}
and I have method:
public List<Fruit> getFruit<T>() where T : Fruit {
List<Fruit> fruitList = new List<Fruit>();
return fruitList.AddRange(session.QueryOver<T>().List());
}
Is it possible to have a dictionary that maps a string to a type that can be passed to this generic method so I can query over the right table?
for example:
Dictionary<string, type> typeMapper = new Dictionary<string, type>()
{
{"Apple", AppleType??}
};
var myType = typeMapper["Apple"];
List<Fruit> fruitList = getFruit<myType>();