Skip to content Skip to sidebar Skip to footer

Dynamic Query Data From Wcf Data Service To Silverlight Application?

I have a Silverlight application that contains a window that lists several values in multiple columns. The first column contains fields to be retrieved from a database, the second

Solution 1:

Silverlight doesn't have a datatable or dataset construct. However, you can fake it with nested lists. This guy put together the silverlight datatable code, and also shows how it can be serialized and sent over WCF: http://blogs.telerik.com/blogs/posts/10-01-22/how_to_serialize_your_datatable_to_silverlight_using_wcf_service.aspx

As for getting the query to the server, you have a few options. You can build linq expression trees dynamically (the same way that domaindatasource does under the covers) and use that to query right from the client. You could also send your search parameters in a serialized form over to the server and construct the query there. Again, you'll either have to build linq expression trees if you want to use LinqToEntities for the query, or you could go old school and just build up an SQL query. If you go SQL, make sure you protect against SQL injection.

I could also suggest that you vote for the dataset/datatable feature to be added to silverlight, which would make your solution a little easier to develop. You can vote for it here.

Post a Comment for "Dynamic Query Data From Wcf Data Service To Silverlight Application?"