I would like to use a query in LINQ and use a function that works like \"LIKE\" in TSQL. For example:
SELECT salary
FROM employees
WHERE last_name LIKE \'R%
Contains
should work as it checks for a substring. It is equal to executing the sql statement where BI_FORMAT_NAME LIKE '%Tom%'
But if need records for LIKE 'Tom%'
condition, You may use StartsWith
method.
where P.BI_FORMAT_NAME.StartsWith("Tom")
It should work as long as your LINQ query without the where
clause is returning records with BI_FORMAT_NAME
column has values like "Tom"
or "TomSomeThingElse"
The LINQ methods for different SQL like
clause use cases are
LIKE '%To%'
--> Contains("To")
LIKE 'Tom%'
--> StartsWith("Tom")
LIKE '%Tom'
--> EndsWith("Tom")