IQueryable<> dynamic ordering/filtering with GetValue fails
- by MyNameIsJob
I'm attempting to filter results from a database using Entity Framework CTP5. Here is my current method.
IQueryable<Form> Forms = DataContext.CreateFormContext().Forms;
foreach(string header in Headers) {
Forms = Forms.Where(f => f.GetType()
.GetProperty(header)
.GetValue(f, null)
.ToString()
.IndexOf(filter,
StringComparison.InvariantCultureIgnoreCase) >= 0);
}
However, I found that GetValue doesn't work using Entity Framework. It does when the type if IEnumerable< but not IQueryable<
Is there an alternative I can use to produce the same effect?