I'm using an API that expects an Expression<Func<T, object>>
, and uses this to create mappings between different objects:
Map(x => x.Id).To("Id__c"); // The expression is "x => x.Id"
How can I create the necessary expression from a PropertyInfo
? The idea being:
var properties = typeof(T).GetProperties();
foreach (var propInfo in properties)
{
var exp = // How to create expression "x => x.Id" ???
Map(exp).To(name);
}