I am looking for the equivalent of this feature of T-SQL:
SELECT *
FROM dbo.users
WHERE CONTAINS (name, 'Jack')
in Entity Framework.
Thanks.
P.S. "contains" in linq is equivalent of LIKE in TSQL (eg., '%jack%'). I'm not looking for this because this kind of search, especially on large databases may affect the performance.
The CONTAINS
keyword is part of the full-text search capability in SQL Server - and as of this day, EF doesn't natively support full-text searching.
There are some approaches out there using EF "interceptors" or plain and simple T-SQL stored procedure to include this functionality into EF - but it's not part of the EF package provided by Microsoft.
See these other SO questions:
In fact, In SQL, it should be
SELECT *
FROM dbo.users
WHERE name like '%Jack%'
And in EF, It equals to
var result = dbContext.users.Where(p => p.name.Contains("Jack"))