If I have a dynamically created ParameterExpression
:
class Product
{
public string Name { get; set; }
}
var propertyName = "Name";
var propertyType = typeof(Product).GetProperty(propertyName).PropertyType;
var parameterExpression = Expression.Parameter(propertyType , propertyName);
How can I covert it into a Func<Product, TPropertyType>
?
I specifically want to pass this into the Where
or OrderBy
linq methods used by entity framework.
I'm also open to other suggestions not using Expressions
, but I highly doubt it's possible.
Aucun commentaire:
Enregistrer un commentaire