开发者

How to use full-text search with Linq? [duplicate]

This question already has answers here: Is it possible to use Full Text Search (FTS) with LINQ? 开发者_开发问答 (6 answers) Closed 9 years ago.

There are 4 functions provided in SQL Server 2008 for full-text search: CONTAINS, CONTAINSTABLE, FREETEXT, FREETEXTTABLE

How to use it them with Linq ?


You cannot translate a linq query into full-text search functions, there is no direct support for this.

However, there are some workarounds - see http://sqlblogcasts.com/blogs/simons/archive/2008/12/18/LINQ-to-SQL---Enabling-Fulltext-searching.aspx for an indirect method of using full-text search.


See stackoverflow post "Is it possible to use Full Text Search (FTS) with LINQ?" which provides a link to the blog post "Linq to SQL - Enabling Fulltext Search"


As far as I know, there's no built-in support for those functions in LINQ - you'll need to formulate your T-SQL query and then use the Linq's DataContext.ExecuteQuery() call to send that T-SQL directly to SQL Server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜