I have an IQueryable and an object of type T.
I want to do IQueryable (). Where (o => o.GetProperty (fieldName) == objectOfTypeT.GetProperty (fieldName))
So...
public IQueryable<T> DoWork<T>(string fieldName)
where T : EntityObject
{
...
T objectOfTypeT = ...;
....
return SomeIQueryable<T>().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName));
}
Fyi, GetProperty is not a valid function. I need something that performs this function.
Do I have a Friday brain on Friday, or is it a tricky thing?
objectOfTypeT I can do the following ...
var matchToValue = Expression.Lambda(ParameterExpression
.Property(ParameterExpression.Constant(item), "CustomerKey"))
.Compile().DynamicInvoke();
Which works fine, now I just need the second part:
return SomeIQueryable (). Where (o => o.GetProperty (fieldName) == matchValue);
source
share