IQueryable<> dynamic ordering/filtering with GetValue fails
Posted
by
MyNameIsJob
on Stack Overflow
See other posts from Stack Overflow
or by MyNameIsJob
Published on 2011-01-06T03:49:17Z
Indexed on
2011/01/06
3:53 UTC
Read the original article
Hit count: 162
c#
|entity-framework
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?
© Stack Overflow or respective owner