Click here to Skip to main content
Rate this: bad
good
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();
       . . . . . .
}</mywcfclass></mywcfclass></mywcfclass>

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:
[Query]
public IQueryable<mywcfclass> GetSomeList()
{
     List<mywcfclass> lst = new Service1Client().GetmyWcfClass();
     return lst.AsQueryable();
}</mywcfclass></mywcfclass>
 
With regards
Any help would be highly appreciated
Posted 16-Jul-10 10:07am
gioa44309
Edited 17-Jul-10 4:27am
v4
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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
List<myClass>
(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)
  Permalink  
v2
Comments
Sandeep Mewara at 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
good
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
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 565
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 17 Jul 2010
Copyright © CodeProject, 1999-2014
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