Using a CompiledQuery breaks my query that uses an IQueryable property of my datacontext

73 Views Asked by At

I have a property on a data context that I use in queries:

public IQueryable<SCCall> NonCompleteCallouts
{
    get
    {
        return SCCalls.Where(call => call.SCCalT.CalT_Est_Work.HasValue &&
                                        call.SCCalT.CalT_Est_Work.Value > 0 &&
                                        call.Call_Status != "COMP");
    }
}

This works fine normally, except for when I try and use it as below, in a CompiledQuery:

var test = CompiledQuery.Compile<TesseractDataContext, IQueryable<SCCall>>(db => db.NonCompleteCallouts)(TDC).ToList();

I get a Sequence contains more than one element error.

What is causing this and what can I do to fix it?

0

There are 0 best solutions below