I have been using L2E for a while, and I am pleasantly surprised with what I have seen so far. Today I ran into one of the expected walls, building dynamic queries (based on incoming request params). Finding a solution to this I stumbled onto Dynamic Linq.
- http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
- http://www.west-wind.com/Weblog/posts/143814.aspx
- http://naspinski.net/post/Writing-Dynamic-Linq-Queries-in-Linq-to-Entities.aspx
Having downloaded a single class implementation for the dynamic part. There I ran into syntax problems when trying to construct a ‘Like’ based query on a string field. Searched for a while until I found this:
Which solved my problems 🙂 🙂 … and L2E still continues to impress on flexibility!
No need for Dynamic LINQ.
You can add an extension method to the String class and tie it to a Model Defined Function in the .edmx.
See http://jendaperl.blogspot.com/2011/02/like-in-linq-to-entities.html