I\'m using LINQ 2 Entities. Following is the problem:
string str = \'%test%.doc%\' .Contains(str) // converts this into LIKE \'%~%test~%.doc~%%\'
The SQL method PATINDEX provides the same functionality as LIKE. Therefore, you can use the SqlFunctions.PatIndex method:
.Where(x => SqlFunctions.PatIndex("%test%.doc%", x.MySearchField) > 0)