What is the best (and fastest) way to retrieve a random row using Linq to SQL when I have a condition, e.g. some field must be true?
Another sample for Entity Framework:
var customers = db.Customers .Where(c => c.IsActive) .OrderBy(c => Guid.NewGuid()) .FirstOrDefault();
This does not work with LINQ to SQL. The OrderBy is simply being dropped.
OrderBy