Skip to main content
Home Forums Silverlight Programming Accessing Web Services with Silverlight return list<object> from WCF to Silverlight
6 replies. Latest Post by Pravinkumar R. D. on November 3, 2009.
(0)
magozeta
Member
0 points
30 Posts
11-03-2009 5:20 AM |
hello all!
How can I return a List<object> from wcf to page.xaml.cs
I have just saw this post: http://forums.silverlight.net/forums/t/23643.aspx but I didn't resolve my problem
bykinag
137 points
51 Posts
11-03-2009 5:49 AM |
without the theory does not get practice, reed this
Pravinku...
Contributor
4300 points
708 Posts
11-03-2009 6:01 AM |
Hi,
Check this blog-
http://pkrd.blogspot.com/2009/08/silverlight-and-database-without-linq.html
It may help you out-
If it is not a database, then simply create a class for example Student-
public class Students { public int InstanceID { get; set; } public int StudentID { get; set; } public string Subject { get; set; } public string Result { get; set; } public string FailedReason { get; set; } }
Then Create a WCF Service method which will return List<Students> class by adding the multiple instances to collection of Students object.
public List<Students> FetchStudentResult() {
List<Students> studCol=new List<Students>();
studCol.Add(new Student(){StudentID=10,Subject="Eng", Result="Pass",FailedReason="None"});
return studCol;
}
Thanks,
Pravin
"Please mark as answered, if this answers your question"
Sergey.L...
7250 points
1,351 Posts
11-03-2009 6:03 AM |
Try to re-create service reference and configure it to return a list at Service Reference Settings window. That window open with Advenced... button at Add Service Reference window.
11-03-2009 9:03 AM |
thanks all!!!
I must return a list of different object each one.
every object is a table in my database. List<object> because I have different structure for every db table.
How can I return from wcf to SL3 a list of different object?
thanks
11-03-2009 9:18 AM |
Listen, you give full information at the top, why you would not use it?
11-03-2009 11:33 PM |
Try to use StoreProcedure. It will help you to return multiple result sets. Check the articles below-
http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/10/05/linq-to-sql-stored-procedures-with-multiple-results-imultipleresults.aspx
http://blogs.msdn.com/swiss_dpe_team/archive/2008/02/04/linq-to-sql-returning-multiple-result-sets.aspx