Manuel Ruiz

Hi.

I have a problem with $expand an Silverlight Client, when I I do

http://localhost:2849/VideoLibraryService.svc/Videos $orderby=DateCreated&$top=5&$expand=Markers,Categories

in my browser everything works fine, but when I try that usin the Silverlight Client I get the following exception:

Cannot add same URI twice

I'm using an asynchronous call back.... I've already verify my connection string and MultipleActiveResultSets is marked True... am I missing something

Thanks in advanced



Re: ADO.NET Data Services (Pre-Release) Problem with and Silverlight Client

Julie Lerman

I first reproduced this with the following query which only expands one child collection, but has the orderby, top and expand in the same order as your query.

http://localhost:50000/WebDataService1.svc/ProductCategory $orderby=Name&$top=5&$expand=Product

Then used it in my already working silverlight app in place of a call that was just getting ProductCategory

WebDataQuery<Category> q = _ctx.CreateQuery<Category>("/ProductCategory $orderby=Name&$top=5&$expand=Product", QueryOption.IgnoreMissingProperties);

And it did not throw an exception.

Then I tried a query that expands two references, though only one is a collection SalesOrderDetails), the other (ProductModel) is a only a reference.

http://localhost:50000/WebDataService1.svc/Product $orderby=Name&$top=5&$expand=ProductModel,SalesOrderDetail

In my client app that looks like this:

WebDataQuery<Product> q = _ctx.CreateQuery<Product>(string.Format("/Product $orderby=Name&$top=5&$expand=ProductModel,SalesOrderDetail",catSelected.Tag), QueryOption.IgnoreMissingProperties);

This also worked.

i have to go trolling for data that better represents your schema because it looks like you are expanding TWO property collections (or is that "collection properties").

Just as a test, does your query work if you take out one of the references in the expand

julie





Re: ADO.NET Data Services (Pre-Release) Problem with and Silverlight Client

Manuel Ruiz

Hi Julie

Thanks four your reply.

Both of the properties I'm trying to expand are collections, if I expand only one (any of them) it works fine, the problem comes only when I to expand both of them, even if I remove the top and orderby commands.

Regards.





Re: ADO.NET Data Services (Pre-Release) Problem with and Silverlight Client

Julie Lerman

I have an inkling that I'd get the same results as you and the problem is:

I guess it's really something for Pablo to respond to.





Re: ADO.NET Data Services (Pre-Release) Problem with and Silverlight Client

Pablo Castro - MSFT

From looking at the error (trying to add duplicate URIs during result processing), most likely this is a glitch in the client library's state manager, which is rudimentary at best. We're building a production-class one now, but the one we shipped in the CTP was a proof of concept and does have some issues like this.

The cause of the issue, if it's what I'm guessing, is that you have duplicate related objects (e.g. more than one video is bound to the same category object). While that's perfectly reasonable, the library may be mistakenly trying to add the second one into the state manager when it should not.

Are you by any chance using QueryOptions.Tracking If so, you can try removing it; that might help as we wouldn't put results in the state manager. Of course, the problem with disabling tracking is that you can no longer use the results for the query for update.

Pablo Castro

Technical Lead

Microsoft Corporation

http://blogs.msdn.com/pablo






Re: ADO.NET Data Services (Pre-Release) Problem with and Silverlight Client

Manuel Ruiz

Hi Pablo.

Thanks for your answer, I'm using QueryOption.IgnoreMissingProperties in my properties, I remove it but didn¡¯t help. I understand this is a problem with the Silverlight Client more than with Astoria, so I think I'll have to wait until a new release to solve my problem.

Thanks and regards.