December 2009 Entries

Implementing "In" the right way with LINQ

If you have ben working with Linq, one of the barriers you may have encountered is the "2100 parameter limit" when attempting to build an "IN" statement through Linq.  A common scenario is that you are given a large list of ID's that you have need to select from.  A common way of implementing this could be reviewed here: http://blog.wekeroad.com/2008/02/27/creating-in-queries-with-linq-to-sql/ However, if you implement this method and have greater than 2100 parameters, your going to need a different option.  Critics will probably argue that "you shouldn't be doing that in the first place" and suggest you examine your design.  But sure enough,...

SqlCacheDependency Database Restore Woes

A quick look at resolving an issue that can arrise when you use the SqlCacheDependency class in conjunction with a database restore job.