I'm new to both OA and Linq so don't know if the following is possible, but would be great to find a way.
I have a query form with 12 fields the user can enter filter values for. When they submit the form the filter values are passed to another page as part of the querystring, e.g:
I would like to build a Linq query based on these filter values, however I don't know which fields the user is going to use for their filter.
Currently I am using OA and Linq to query my datasource:
|Using context as JobTrackerEntityDiagrams = New JobTrackerEntityDiagrams
| Dim proj = From c In Context.Projects _
| Select c
I know I can add Where clauses to the query like so (assuming the field being queried is 'Project' and I've put the querystring value into a variable called a_project :
|proj = proj.Where(Function(p) p.Project.Contains(a_project))
But that only works when I know the user is filtering on the Project field. I could build a huge number of Ifs and adjust the query in each one, but this seems very in-elegant.