Add Random newid() support to TypedDataContext
Super easy, add this method to your Program script:
[System.Data.Linq.Mapping.Function(IsComposable=true)]
public Guid NewId() => Guid.NewGuid();
Then use like this:
Users.OrderBy(o => NewId())
This will translate to the usual sql statement for the server-side execution:
select * from Users order by newid()
Which is shuffling on the server side.
The C# implementation is never used (Guid.NewGuid()) but is useful nonetheless if someone calls it from the application-side. You can replace it with throw new NotImplementedException() and it will still work just fine.
Would be great if it was embedded into the TypedDataContext (or elsewhere) within LinqPad.
Based on Marc's answer here: https://stackoverflow.com/questions/648196/random-row-from-linq-to-sql