We can use the method .Contains(string)
in a LINQ Expression, that sounds like '%search text%', method .StartsWith(string)
, that sounds like 'search text%', and method .EndsWith(string)
, that sounds like '%search text'.
But I need something that sounds '%search%text%', that finds all content containing 'search' and 'text', but not sequential.
Example: I have these records:
search my text
search for the text
seek the text
In SQL, the query with LIKE '%search%text%'
brings:
search my text
search for the text
But not brings the 'seek the text'
.
Any ideas?
You can use one of the helper method:
var result = from o in ctx.table
where SqlMethods.Like(o.column, "%search%text%")
select o.column;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With