I have the following linq query:
Dim q = From definition In definitionList _
Where definition.ValueDefName.Contains(criteria) _
Select definition.ValueDefName, definition.ValueDefDesc, definition.DateCreated, _
definition.StrategicInitiative, definition.ValueWikiURL, definition.ValueDefinitionStatusID, _
definition.Aliaslist
I have already looked into this answer: Dynamic WHERE clause in LINQ
Unfortunately, it doesn't work for me using .net 4.0. When I attempt to pass the criteria string in it ask for a predicate. The end goal is to add any of these:
- definition.ValueDefname.Contains(criteria)
- definition.ValueDefDesc.Contains(criteria)
- definition.Aliaslist.Contains(Criteria)
- definition.StrategicInitiative.Contains(Criteria)
to be passed into the query depending on what checkboxes the user has selected. How can I create a dynamic where clause in linq to sql? Is there new syntax for passing in a where clause as a string?