I would like to create a function to retrieve a List of a given property name's Type. But i dont know yet how to create a working lambda selector.
public IList<object> GetDistinctListOfProperty(string propertyName)
{
var propInfoByName = typeof(T).GetProperty(propertyName);
if (propInfoByName == null) return new List<object>();
using (var db = new ApplicationDbContext())
{
var lambda = //TODO
return db.Set<T>().Select(lambda).Distinct().ToList();
}
}