I am using Lightspeed 4.0.1600.21511 (nightly 26 sept 2012) on the Northwind database. I try to select categories with discontinued products with a supplier in London.
Both of these work:
uow.Categories.Where(c => c.Products.Any(p => p.Supplier.City == "London"))
uow.Categories.Where(c => c.Products.Any(p => p.Discontinued == true))
This throws an exception:
uow.Categories.Where(c => c.Products.Any(p => p.Supplier.City == "London" && p.Discontinued == true))
I expect this to return the intersection of the two queries above. Exception:
Mindscape.LightSpeed.LightSpeedException was unhandled
Message=Query Error: Could not find field [Discontinued] on model [Suppliers]
Source=Mindscape.LightSpeed
StackTrace:
at Mindscape.LightSpeed.LightSpeedException.(Exception , String , Object[] )
at Mindscape.LightSpeed.LightSpeedException.(String , Object[] )
at ..(String )
at ..(IdentifierExpression , FieldModel& , ToOneModel& , & , String& )
at ..(IdentifierExpression , FieldModel& , ToOneModel& , & , String& )
at ..(IdentifierExpression )
at Mindscape.LightSpeed.Querying.IdentifierExpression.[T](IExpressionVisitor`1 )
at ..(PredicateExpression )
at ..(PredicateExpression )
at Mindscape.LightSpeed.Querying.PredicateExpression.[T](IExpressionVisitor`1 )
at ..(LogicalExpression )
at Mindscape.LightSpeed.Querying.LogicalExpression.[T](IExpressionVisitor`1 )
at ..(LiftedPathExpression )
at Mindscape.LightSpeed.Querying.LiftedPathExpression.[T](IExpressionVisitor`1 )
at ..(AliasedTypeModel , QueryExpression , Order , Group , String , Boolean , Boolean )
at ..(AliasedTypeModel , QueryExpression , ProjectionCollection , Boolean , Boolean )
at ..(List`1 , Query , String , IdentifierExpression )
at ..(List`1 , Query )
at ..(Query )
at Mindscape.LightSpeed.UnitOfWork.Project(Query query)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ExecuteProjectNativeCore(IUnitOfWork unitOfWork, IProjectionBuilder builder)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.DispatchProjectNative[T](IUnitOfWork unitOfWork, Func`3 builderFunc)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ExecuteProjectNative(IUnitOfWork unitOfWork)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.<>c__DisplayClass1d.<ExecuteProject>b__1b()
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ChooseProjectImplementation[T](Func`1 native, Func`1 clientSide)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ExecuteProject(IUnitOfWork unitOfWork)
at Mindscape.LightSpeed.Linq.Plan.SingleQueryPlan.ExecuteImmediate(IUnitOfWork unitOfWork, Type returnType)
at Mindscape.LightSpeed.Linq.LinqQueryProvider.Execute(Expression expression)
at Mindscape.LightSpeed.Linq.LinqQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression)
at Mindscape.LightSpeed.Linq.LinqQuery`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Northwind.Form1.button1_Click(Object sender, EventArgs ea) in D:\Projects\Northwind\Northwind\Form1.cs:line 29
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Northwind.Program.Main() in D:\Projects\Northwind\Northwind\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: