The Visual Basic Team - Implementing Dynamic Searching Using LINQ
"A common requirement in forms-over-data applications is that users be able to search by any combination of fields to construct a dynamic query at run time. For example, the search feature in this application allows the user to find all records that meet criteria defined on multiple columns:
![]()
This is easy at compile-time, but what if we want to check the date the order was entered instead of the date it was shipped? In this case we’d have to write a separate query using order.OrderDate. Doing this dynamically at runtime isn’t all that difficult if you’re just building up a SQL string, but how would we do this with LINQ? Doesn’t LINQ require me to specify the criteria at compile time in order to construct the query? Fortunately the answer’s no, LINQ supports constructing dynamic queries at runtime through the Expression Tree API and the Expression Compiler.
..."
This is a wheel that we seem to reinvent all the time, isn't it? A user driver query builder...
This post provides an interesting solution and uses many of the new cool VB9 features like expression trees, lambda expressions, LINQ, etc.
I'm going to queue this for a closer look when VS2008 RTM's.
No comments:
Post a Comment
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...