Take the 2-minute tour ×

In my LINQ DataContext class I have a function which I use to sort items in a random order:

  [Function(Name = "NEWID", IsComposable = true)]
    public Guid Random()
    { // to prove not used by our C# code... 
        throw new NotImplementedException();

It works correctly in some queries (calls the NEWID function), but in some it doesn't (throws a NotImplementedException). Why?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Probably it crashes if it is attached to an IQueryable that has already been compiled and executed on the SQL server.

share|improve this answer
probably it is the case –  Bogdan Verbenets Mar 25 '11 at 20:26

Your Answer


