Reputation: 1030
using the following LINQ query:
EntityQuery<Questions> query = context.GetQuestionsQuery()
.Where(o => o.SurveyQuestions.Any(o2 => o2.SurveyID == 3));
However when using LINQPad...it works fine.
Questions.Where(o => o.SurveyQuestions.Any(o2 => o2.SurveyID == 3)).Dump();
is this a limitation of Silverlight? If so How can i do the same thing in a silverlight friendly way? On a little more investigation this looks like its being caused in the DomainContext.Load operation.
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; .NET CLR 1.1.4322) Timestamp: Mon, 28 Feb 2011 18:06:11 UTC
Message: Unhandled Error in Silverlight 2 Application Query operator 'Any' is not supported. at System.ServiceModel.DomainServices.Client.WebDomainClient
1.BeginQueryCore(EntityQuery query, AsyncCallback callback, Object userState) at System.ServiceModel.DomainServices.Client.DomainClient.BeginQuery(EntityQuery query, AsyncCallback callback, Object userState) at System.ServiceModel.DomainServices.Client.DomainContext.Load(EntityQuery query, LoadBehavior loadBehavior, Action
1 callback, Object userState)
at System.ServiceModel.DomainServices.Client.DomainContext.Load[TEntity](EntityQuery1 query, LoadBehavior loadBehavior, Action
1 callback, Object userState)
at System.ServiceModel.DomainServices.Client.DomainContext.Load[TEntity](EntityQuery1 query, Action
1 callback, Object userState) at ReadmissionTrackingApplication.Client.ViewModel.QuestionairreViewModel.ReceiveNewQuestionairreRequest(fnReadmitPatientList_Result request) at GalaSoft.MvvmLight.Helpers.WeakAction1.Execute(T parameter) at GalaSoft.MvvmLight.Helpers.WeakAction
1.ExecuteWithObject(Object parameter) at GalaSoft.MvvmLight.Messaging.Messenger.SendToList[TMessage](TMessage message, IEnumerable`1 list, Type messageTargetType, Object token) at GalaSoft.MvvmLight.Messaging.Messenger.SendToTargetOrType[TMessage](TMessage message, Type messageTargetType, Object token) at GalaSoft.MvvmLight.Messaging.Messenger.Send[TMessage](TMessage message) at ReadmissionTrackingApplication.Client.ViewModel.PrimarySearchViewModel.OpenSurveyCommand_Execute() at ReadmissionTrackingApplication.Client.ViewModel.PrimarySearchViewModel.b__2() at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter) at System.Windows.Controls.Primitives.ButtonBase.ExecuteCommand() at System.Windows.Controls.Primitives.ButtonBase.OnClick() at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName) Line: 1 Char: 1 Code: 0 URI: http://localhost/readdtrackapp/Silverlight.js
Upvotes: 1
Views: 1157
Reputation: 11607
Its because not all the LINQ queries are supported by EntityQuery
class. Only the following operators would work with EntityQuery:
Upvotes: 1