0

In a Silverlight application I have a datasource, that is displayed in a grid with a pager. There are a couple of controls that change parameters of the query and/or filtering. The pager is used (obviously) because the number of returned items can be quite large.

For a certain action I want only the Ids (Guids) of all the items in the datasource. How can I achieve this? I'd like to do this without having to transfer all the data objects.

So basically something like

dds.Select(o => o.Id).ToList()
H. de Jonge
  • 878
  • 7
  • 25
  • You can't get all the Ids of all the items in the datasource without loading all the items in the datasource. Your other option would be to create another query (datasource) which only returns the Ids. – Slugart Aug 22 '12 at 09:00
  • I was a little bit afraid of this answer, but thanks for the confirmation. – H. de Jonge Aug 22 '12 at 09:22
  • Maybe you can make use of Table Splitting to not pull down the whole resultset: http://stackoverflow.com/questions/3274241/entity-framework-4-selective-lazy-loading-properties – Slugart Aug 22 '12 at 09:41
  • So how can I load all items without messing up the pager? Is it possible to create a secondary DataSourceView, associated with the same datasource? Or should I use a duplicate DataSource? Or...? – H. de Jonge Aug 22 '12 at 13:39
  • One way or another you will use a secondary view (with no paging). The question is whether it's better to define another datasource (and query) with just the Id in it or partition out any expensive fields into separate tables (re-use the same datasource). – Slugart Aug 23 '12 at 07:42

0 Answers0