I am developing an ASP.NET MVC 3 application using C# and Razor.
I have a search form that looks like this:
The search form works in the following way:
- The user selects which property they want to search on.
- The user selects how they want to match the search string (e.g. contains, starts with, ends with, equals, etc).
- The user enters a search term and clicks Search.
The selections in the first drop down related directly to a property in my ADO.NET Entity Framework model class (and therefore directly to a table column).
Users need the ability to explicitly select which property and which matching method when searching, e.g. a user will explicitly search for all matches of process number that equals '132'.
My first approach was to use dynamic linq to construct a Where clause from the search criteria (see my original question). However I'm starting to think that this isn't the best way to do it.
I'm also hoping for a solution that doesn't require me to hard code the result for each property + matching criteria combination.
Any suggestions on how I should implement this search? It doesn't have to be using my current search form, totally open to any other ideas that fit the requirements.