views:

93

answers:

1

As I read the a similar question about searching SQL I realized I am very curious on how to do the same thing in Linq.

Assume a DB Table with the fields "Title", "Tags" (comma separated) and "Body" (HTML) that has been connected to a Linq2[Entities|Sql] How would you go about searching for a string across those fields.

Yes, I could brute force it but I hope there is something elegant that would suit better.

+1  A: 

The right way to do this is with Full Text Search, such as SQL Server FTS catalogs or Lucene.

The easy way to do it is by downloading Microsoft Dynamic LINQ (Google it), and dynamically building a predicate. I have a demo solution which does just that (with LINQ to Objects, not LINQ to Entities, but the idea is the same) here.

Craig Stuntz