posts - 54, comments - 158, trackbacks - 4

My Links

Archives

Post Categories

Projects

Web Dev

Randomizing LINQ Queries

I've been using LINQ (with SqlMetal) a lot lately with MVC. I needed to grab a random single record. To my surprise there didn't appear to be a way to do this. I found an interesting post that confirms this and provides a workaround.

 

http://weblogs.asp.net/fmarguerie/archive/2008/01/10/randomizing-linq-to-sql-queries.aspx

 

The workaround is to create a function which returns a newid. As the function can be mapped by SqlMetal the function will be available for sorting server side. Interesting… just a shame the function NEWID() isn't part of DLINQ.

Print | posted on Friday, August 29, 2008 10:37 PM | Filed Under [ Web Programming ]

kick it on DotNetKicks.com

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 8 and 5 and type the answer here:

Powered by: