locked
wcf-ria service报错!!!! RRS feed

  • 问题

  • 网页错误详细信息

    用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; CIBA; InfoPath.2; .NET4.0C; .NET4.0E)
    时间戳: Wed, 6 Jan 2010 13:48:35 UTC


    消息: Unhandled Error in Silverlight Application
    Code: 4004   
    Category: ManagedRuntimeError      
    Message: System.Windows.Ria.DomainException: An error occurred while loading data through the 'GetWeb_新闻表' query on DomainContext of type 'DomainService2' and the error was not handled.  If this error is expected, then you must handle the LoadedData event on the DomainDataSource and call LoadedDataEventArgs.MarkErrorAsHandled() to avoid this exception.

    Load operation failed for query 'GetWeb_新闻表'. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. ---> System.Windows.Ria.DomainOperationException: Load operation failed for query 'GetWeb_新闻表'. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.
       --- 内部异常堆栈跟踪的结尾 ---
       位于 System.Windows.Ria.OperationBase.InvokeCompleteAction()
       位于 System.Windows.Ria.OperationBase.Complete(Exception error)
       位于 System.Windows.Ria.LoadOperation.Complete(Exception error)
       位于 System.Windows.Ria.DomainContext.CompleteLoad(IAsyncResult asyncResult)
       位于 System.Windows.Ria.DomainContext.<>c__DisplayClass17.<Load>b__13(Object )    

     

    2010年1月6日 13:49

答案

  • EntityFramework 需要 先调用OrderBy 才能用Skip/Take.
    在你的'GetWeb_新闻表'  方法中, 要添加类似如下

    return this.ObjectContext.Web_新闻表.OrderBy(p => p.<MyKey>); //  <MyKey> == 你表的主键名称
    2010年1月8日 22:34

全部回复

  • 查询和数据结构的有问题吧
    Load operation failed for query 'GetWeb_新闻表'. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. ---> System.Windows.Ria.DomainOperationException: Load operation failed for query 'GetWeb_新闻表'. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.


    My blog: http://blog.csdn.net/dotfun http://dotfun.cnblogs.com

    My contact: QQ:372900288 E-mail:372900288@qq.com msn:sellnet007@hotmail.com

    2010年1月7日 9:31
  • EntityFramework 需要 先调用OrderBy 才能用Skip/Take.
    在你的'GetWeb_新闻表'  方法中, 要添加类似如下

    return this.ObjectContext.Web_新闻表.OrderBy(p => p.<MyKey>); //  <MyKey> == 你表的主键名称
    2010年1月8日 22:34