views:

307

answers:

1

We're using Silverlight 2 with ADO.NET dataservices and to test the silverlight page we used a service in the same domain which works fine. We then decided to try use a proxy or intermediate service (sitting in the same domain as the Silverlight app) which basically just surfaces a service sitting in another domain (by using the class generated in the service reference of the service in the other domain as the type exposed in our local service and creating an constructor which sets the Uri to point to). We wanted to do it this way as we would like to have our silverlight server sitting in the DMZ and our service on the internal domain as we will be using the service for internal applications too and this seems to be a way around the cross-domain limitations of Silverlight.

This works fine when we use the following query:

var questions = (from q in context.Question
                            select q)

But as soon as we try to use expand as in:

var questions = (from q in context.Question.Expand("Answers")
                            select q)

we get an exception stating:

Can only specify query options (orderby, where, take, skip) after last projection.

Where the stack trace is:

at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable) at System.Data.Services.DataService1.SerializeResponseBody(RequestDescription description, IDataService dataService) at System.Data.Services.DataService1.HandleNonBatchRequest(RequestDescription description) at System.Data.Services.DataService`1.HandleRequest()

Does anyone have any suggestions as to the reason behind this? This works fine on the internal service of course but I would have thought that since the query is composable this would have worked on the proxy service too...

Any help would be greatly appreciated!

+1  A: 

We managed to get around this problem by using the LoadProperty method on the client side. So that we retrieve all the questions and then call LoadProperty("Answers") and the questions.

James_2195