How to do SQL Like % in Linq?
.net, linq, linq-to-entities, sql-like, t-sql
Solution
.Where(oh => oh.Hierarchy.Contains("/12/"))
You can also use `.StartsWith()` or `.EndsWith()`.
Problem
I have a procedure in SQL that I am trying to turn into Linq: ``` SELECT O.Id, O.Name as Organization FROM Organizations O JOIN OrganizationsHierarchy OH ON O.Id=OH.OrganizationsId where OH.Hierarchy like '%/12/%' ``` The line I am most concerned with is: ``` where OH.Hierarchy like '%/12/%' ``` I have a column that stores the hierarchy like /1/3/12/ for example so I just use %/12/% to search for it. My question is, what is the Linq or .NET equivalent to using the percent sign?