This question is locked. New answers and comments are not allowed.
Hello,
I have a problem using Query interceptors in a ADO.NET Data Service.
For the test I used the Silverlight integration sample application using the NorthWindOA database.
This is the code in the Silverlight application of the query of Orders and OrderDetails using Expand:
In the Data Service I implemented two Query interceptors for Orders and OrderDetails.
If I only implement the Query interceptor for Orders everything works ok.
If I add the Query interceptor for OrderDetails I get an Error:
Is this error related to OA or ADO.NET Data Services?
I have a problem using Query interceptors in a ADO.NET Data Service.
For the test I used the Silverlight integration sample application using the NorthWindOA database.
This is the code in the Silverlight application of the query of Orders and OrderDetails using Expand:
// Create the Service class specifying the location of the ADO.NET Data Services |
this.context = new OADataContext(new Uri("OADataService.svc", UriKind.Relative)); |
var Orders = |
(from o |
in this.context.Orders.Expand("OrderDetails") |
select o |
) as DataServiceQuery<Order>; |
//use code block to perform the binding at the end of the async call |
//casting the Customers to a LIST |
Orders.BeginExecute( |
(ar) => this.RadGridView1.ItemsSource = Orders.EndExecute(ar).ToList(), null); |
[QueryInterceptor("Orders")] |
public Expression<Func<Model.Order, bool>> OnQueryOrders() |
{ |
return i => i.OrderID < 10255; |
} |
[QueryInterceptor("OrderDetails")] |
public Expression<Func<Model.OrderDetail, bool>> OnQueryOrderDetails() |
{ |
return i => i.OrderID < 10255; |
} |
If I add the Query interceptor for OrderDetails I get an Error:
System.Data.Services.Client.DataServiceQueryException was unhandled by user code |
Message="An error occurred while processing this request." |
StackTrace: |
at System.Data.Services.Client.QueryAsyncResult.EndExecute[TElement](Object source, IAsyncResult asyncResult) |
at System.Data.Services.Client.DataServiceQuery`1.EndExecute(IAsyncResult asyncResult) |
at OASilverlightTestApp.Page.<>c__DisplayClass1.<.ctor>b__0(IAsyncResult ar) |
at System.Data.Services.Client.BaseAsyncResult.HandleCompleted() |
at System.Data.Services.Client.QueryAsyncResult.AsyncEndRead(IAsyncResult asyncResult) |
at System.IO.Stream.BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state) |
at System.Data.Services.Client.QueryAsyncResult.AsyncEndGetResponse(IAsyncResult asyncResult) |
InnerException: System.InvalidOperationException |
Message="An error occurred while saving changes. See the inner exception for details." |
StackTrace: |
at System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult) |
at System.Data.Services.Client.QueryAsyncResult.EndExecute[TElement](Object source, IAsyncResult asyncResult) |
InnerException: System.Data.Services.Client.DataServiceClientException |
Message="<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n <code></code>\r\n <message xml:lang=\"nl-NL\">Not Implemented</message>\r\n</error>" |
StatusCode=501 |
InnerException: |