To convert the SQL LIKE query to LINQ which having "%"(percentage) operators both at the start and end of the string, we use the Contains()
method.
e.g.
SELECT * FROM [User] WHERE Username LIKE '%test%'
The equivalent LINQ is:
var users = (from usr in Context.Users
where usr.Username.Contains("test")
select usr).ToList();
What will be equivalent of the below query which contains multiple "%"(percentage) operators in the input text?
SELECT * FROM [User] WHERE Username LIKE '%test%email%'
Any help is appreciated.
Note: The query will be executed in the EntityFramework(version 6.1.3)