How to use “contains” or “like” in a dynamic linq query?

Here is the answer! The Dynamic Linq does support the . Operator According to the docs: Instance field or instance property access.

Any public field or property can be accessed Thus, it is possible to use this syntax Where("MyColumn. Contains(@0)", myArray) Thanks for all the suggestions! And thanks to me for finding the solution.

Here is the answer! The Dynamic Linq does support the . Operator, According to the docs: "Instance field or instance property access.

Any public field or property can be accessed. " Thus, it is possible to use this syntax . Where("MyColumn.

Contains(@0)", myArray) Thanks for all the suggestions! And thanks to me for finding the solution.

Try these links: velocityreviews.com/forums/t589023-dynam... simonrhart.com/2008/06/using-like-in-lin... forums.asp.net/t/1217305.aspx blogs.microsoft.co.il/blogs/bursteg/arch....

I think the SqlMethods. Like is the best solution since it gives real pattern matching. – Payton Byrd Mar 16 '10 at 15:35.

Contains is . Contains For like check this davidhayden.com/blog/dave/archive/2007/1... This is from first link in google request "like operator in linq to sql". Please, google first.

Actually, there is direct support for the like operator in Linq2Sql: db.MyTable. Where(a => SqlMethods. Like(a.Name, "%"+searchTerm+"%")) See here: msdn.microsoft.com/en-us/library/system.... ... but I prefer using startsWith, endsWith and contains for most applications.

Please note that the solution provided only works for simple cases: if you want to use parameters for the source of the Contains call, and/or if you want to use the current queried collection to be used as parameter for the Contains call, then the solution provided won't work. You can find in the following blog post a solution to properly extend the Dynamic Linq library and add support for Contains extension: blog.walteralmeida.com/2010/05/advanced-....

The Dynamic Linq does support the . Can be accessed." Thanks for all the suggestions!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions