New Posts New Posts RSS Feed: How to create paged data collection using devforce EntityManager ?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

How to create paged data collection using devforce EntityManager ?

 Post Reply Post Reply
Author
ehsan View Drop Down
Newbie
Newbie
Avatar

Joined: 02-Jun-2010
Posts: 15
Post Options Post Options   Quote ehsan Quote  Post ReplyReply Direct Link To This Post Topic: How to create paged data collection using devforce EntityManager ?
    Posted: 21-Jun-2010 at 8:56pm
{EntityServerException: The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. ---> System.NotSupportedException: The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.
   at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.HandleException(Exception e, PersistenceFailure failureType)
   at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.OnExecuteQuery()
   at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.Execute(IEntityQuery entityQuery, SessionBundle sessionBundle, EntityServer entityServer)
   at IdeaBlade.EntityModel.Server.EntityServer.Fetch(SessionBundle sessionBundle, IEntityQuerySurrogate surrogate)
   at SyncInvokeFetch(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
   at IdeaBlade.EntityModel.EntityManager.HandleEntityServerException(Exception pException, Boolean pTryToHandle, PersistenceOperation pOperation)
   at IdeaBlade.EntityModel.EntityManager.<ExecuteQueryAsyncCore>b__4e[T](EntityQueryOperation`1 op)
   at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__5(Object x)}
 
Oh, I understood the problem ! It's so simple I just dont know why I didn't care this message before posting this topic !!!
I must use OrderBy section before using skip :
 

IEntityQuery<testTable> query = (from r in mgr.testTables select r).OrderBy(r => r.id).Skip(this.pageSize * this.pageIndex).Take(this.pageSize);



Edited by ehsan - 21-Jun-2010 at 9:15pm
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jun-2010 at 5:20pm
What does the InnerException say?
Back to Top
ehsan View Drop Down
Newbie
Newbie
Avatar

Joined: 02-Jun-2010
Posts: 15
Post Options Post Options   Quote ehsan Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jun-2010 at 4:51am

I want to use this query to create a paged datasource for a datapager :

IEntityQuery<testTable> query = (from r in mgr.testTables select r).Skip(this.pageSize * this.pageIndex).Take(this.pageSize);

query.ExecuteAsync(

args =>

{

IEnumerator e = args.Results.GetEnumerator();

}

);
 
but I get this exception when "args.Results.GetEnumerator()" executes :
 
An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.
 
It executes OK when I remove Skip & Take sections . Any idea(blade!) ?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down