Click here to Skip to main content
11,922,641 members (32,073 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Silverlight
Hello to everybody.

I have one problem. I have created new Silverlight Business Application project and added Domain Service Class in web project part. Now I want to write one method in Domain Service Class that returns IQueryable<myclass> and use it from Silverlight projects Client side. The data should be taken from remote WCF Service (hosted in IIS) and "myWcfClass" is also defined there (with SerializableAttribute and [Key] specified).

The method of Remote Service Class looks like this one:
public IQueryable<mywcfclass> GetSomeList()
//this does not work because of GetmyWcfClass method returns myWcfClass[] type instead of List<mywcfclass>. is there any deal with it ???
       List<mywcfclass> = new Service1Client().GetmyWcfClass();
       . . . . . .

It does not matter what code is inside this method, when the compiler sees myWcfClass (through Web Service Reference I created for WCF Web Service) it shows the error:

Entity 'myBusinessApp.Web.RefRemoteWebService.myWcfClass' has a property 'ExtensionData' with an unsupported type.

I want to get something like this to work:
public IQueryable<mywcfclass> GetSomeList()
     List<mywcfclass> lst = new Service1Client().GetmyWcfClass();
     return lst.AsQueryable();

With regards
Any help would be highly appreciated
Posted 16-Jul-10 10:07am
Edited 17-Jul-10 4:27am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Tragically, I don't think that will work. WCF will rely in having a serializable output from the method and IQueryable won't be. I'm afraid you can't really defer execution across a serialization boundary.

You could use IEnumerable<>, but when you generate your proxy you'll need to select how that will be exposed (Array or Generic List). If you pick generic list, you should be able to use the IQueryable methods again.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Thank you for your answer, maybe I not declared my problem well. and my code also is not showed exactly by this site. I'm using IQueryable generic class, that was not shown.

public IQueryable<myClass> GetSomeList()
this method is not defined in WCF Service, but exists in Domain Service Class, WCF Service returns just
(myClass resides in WCF), but in proxy myClass looks like different (there is ExtensionData of type System.Runtime.Serialization.ExtensionDataObject added for additional information) and Silverlight can't understand it as supported type for entities, to transfer it to Silverlight client

And also I want to tell that similar method
public IQueryable<myLocalClass> GetSomeList()
Declared in Domain Service Class works fine and is transfered to Silverlight Client side well (myLocalClass is declared absolutely in the same way myClass in WCF Service is, but it resides within Domain Service Class's assembly)
Sandeep Mewara 17-Jul-10 9:35am
If you update the question using 'Improve Question' instead of posting an answer, it might help you getting more answers.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Ok, thank you very much everyone who tried to help or red my post. I solved this problem by just removing ExtensionData property from generated proxy version of my myClass type

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151125.1 | Last Updated 17 Jul 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100