Wednesday, April 25, 2012

Building a dynamic search with LINQ (think WHERE chaining)

Paul Sheriff's Blog for the Real World - Dynamic Search with LINQ, the Entity Framework and Silverlight – Part 2

"After my previous blog post, I realized that using SQL strings is not a great way to do things. Sometimes we start blogging too quick and then realize our mistakes after. But, no big deal, live and learn... I am going to now rewrite this application and use some lambda expressions to solve the problems inherit with concatenating strings to SQL statements; namely escaping a single quote and SQL Injection attacks. I am going to use the same search screen shown in Figure 1.

image..."

I thought this an interesting example of building a dynamic, user driven, multiple field query (or "where" wizard). Not sure I like the case usage (that looks like it could easily spiral out of maintenance control), but it does make it easy to read and grok (and this is just a demo)...

1 comment:

  1. Predicate Builder is a much better option IMHO.

    http://www.albahari.com/nutshell/predicatebuilder.aspx

    ReplyDelete

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...