Skip to content

Instantly share code, notes, and snippets.

@neoGeneva
Created June 27, 2012 21:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save neoGeneva/3007125 to your computer and use it in GitHub Desktop.
Full-Text Search From EF4
public static class ObjectQueryExtensions
{
public static ObjectQuery<T> FullTextSearch<T, TProperty>(this ObjectQuery<T> query, Expression<Func<T, TProperty>> propertyExpression, string searchText)
{
var path = string.Join(".", propertyExpression.ToString().Split('.').Skip(1));
return query.Where(string.Format("CONTAINS(it.{0}, @search_text)", path), new ObjectParameter("search_text", searchText));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment