Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LIKE with Linq to Entities

I know the .Contains() method does like LIKE %therm%, the .StartsWith() method does like LIKE therm% and the .EndsWith() method like LIKE %therm but...

Is there a way to do like below on **Linq to Entities**?

SELECT * FROM [dbo].[Users] WHERE Name LIKE 'rodrigo%otavio%diniz%waltenberg'

PS: I'M USING LINQ TO ENTITIES. NOT LINQ TO SQL

like image 211
Rodrigo Waltenberg Avatar asked Oct 20 '10 19:10

Rodrigo Waltenberg


1 Answers

Yes, you can do this with ESQL/Query Builder syntax:

var matching = Context.Users.Where("it.Name LIKE 'rodrigo%otavio%diniz%waltenberg'");
like image 164
Craig Stuntz Avatar answered Oct 02 '22 19:10

Craig Stuntz