DataContext random function sometimes fails
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();
开发者_如何学C }
It works correctly in some queries (calls the NEWID function), but in some it doesn't (throws a NotImplementedException). Why?
Probably it crashes if it is attached to an IQueryable that has already been compiled and executed on the SQL server.
精彩评论