RIA Services error
I have a domaindatasource with a filter descriptor. This is for a textbox used to search the data. it filters out only the names which start with the text. I'm getting an error whenever text is entered in the search box. Part of the error message says this:
'The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip''
I'm not able to drill down into it and locate the linq statement used by the filter only the original query. Can anyone tell me where this linq statement is or how i might find it?
UPDATE
This is the full error message:
Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Timestamp: Thu, 6 Jan 2011 20:45:30 UTC Message: Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError Message: System.Windows.Ria.DomainException: An error occurred while loading data through the 'GetEmployeesView' query on DomainContext of type 'AllocationContext' 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 'GetEmployeesView'. The method 'Skip' is only supported for sorted i开发者_JS百科nput in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. ---> System.Windows.Ria.DomainOperationException: Load operation failed for query 'GetEmployeesView'. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. --- End of inner exception stack trace --- at System.Windows.Ria.OperationBase.InvokeCompleteAction() at System.Windows.Ria.OperationBase.Complete(Exception error) at System.Windows.Ria.LoadOperation.Complete(Exception error) at System.Windows.Ria.DomainContext.CompleteLoad(IAsyncResult asyncResult) at System.Windows.Ria.DomainContext.<>c_DisplayClass17.b_13(Object ) Line: 56 Char: 13 Code: 0
The 'GetEmployeesView' is the RIA domian service query which returns a list of Employees from an 'EmployeesView' entity (built from a SQL view).
Your RIA methods must return an collection that implements IQueryable. DomainDataSource forms its load, sort, and filter queries behind the scenes using LINQ Take(), Skip(), and so on. The easiest way to 'see' these queries if you're interested is to fire up Fiddler and look at the request as it goes across the wire.
精彩评论