New Posts New Posts RSS Feed: POCO Queries...
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

POCO Queries...

 Post Reply Post Reply
Author
jsobell View Drop Down
Groupie
Groupie
Avatar

Joined: 02-Apr-2009
Location: Australia
Posts: 80
Post Options Post Options   Quote jsobell Quote  Post ReplyReply Direct Link To This Post Topic: POCO Queries...
    Posted: 22-Jun-2009 at 12:05am
It appears that the POCO implementation is a great way of allowing inclusion of short lists of items such as US states in queries, but there are often times when we need to return a subset of a large server side collection and we can't quite see how this would be done.
For example, we would like to return a collection of images where the filename begins with "A", so how would this be implemented?
The standard GetImageCollection() approach appears to have to read every single image into an IEnumerable collection so that the client can subsequently filter them, while the ideal would be to allow GetImageCollection(string myfilter) so the query can be "from img in ImageCollection("A*.*") select img".
I know it's not an ivory tower solution, but is there another way to approach this other than adding a custom webservice?
If we are forced to add the webservice, how can we leverage the existing security session?  When fetching data from SQL server it is passed the query, but the POCO example seems to assume that you return everything and filter afterwards.

Cheers,
 Jason
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2009 at 8:12am
We will be adding support for query parameters in the next release, so you'll be able to do GetImageCollection(args..) then.  For now, one workaround would be to use the InvokeServerMethod, which does allow you to pass arguments.
Back to Top
ouelletf View Drop Down
Newbie
Newbie
Avatar

Joined: 15-May-2009
Location: Québec, Canada
Posts: 9
Post Options Post Options   Quote ouelletf Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2009 at 8:24am
Would it be possible to also receive the query expression ?

I think you want to respect RIA standard.
Maybe you could have both RIA method, and a custom interface that allow us to receive the expression ?

Your POCO is a really nice feature.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2009 at 6:27pm
I want to clarify how query expressions and filtering work with POCO queries, since I may have given the impression that filtering of any sort can only be done on the client right now, which is not true.
 
The Where clause or Filter added to a query client-side,  although not passed into the query method, is still executed on the server prior to sending the results to the client.  You can also implement a server-side IEntityServerFetching to add a Filter to POCO queries.   It's true that the query method, as the "data source", may need to load more data than necessary to fulfill the query (and why we will add support for parameters) but not all that data is necessarily returned to the client. 
 
Back to Top
jsobell View Drop Down
Groupie
Groupie
Avatar

Joined: 02-Apr-2009
Location: Australia
Posts: 80
Post Options Post Options   Quote jsobell Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2009 at 6:55pm
Thanks Kim,
Yes, I guessed that the sets were filtered at the server end, but the idea of loading 20MB of images into a collection simply to let the server then check the filename is a huge overhead.
We are currently struggling with the undocumented InvokeServerMethodAsync method (did I also mention that there are no examples and it's undocumented? :) )

Cheers,
 Jason
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2009 at 7:06pm
We were just talking about the undocumented InvokeServerMethodAsync at an engineering meeting this morning. :)  It may still remain largely undocumented for another release.  We'll see.
 
There's a snippet in the Help reference (which has the unfortunate name of IdeaBladeDevForceV4ReferenceHelp.chm) for the synchronous version of InvokeServerMethod.  The async signature isn't too different.  If you have any questions, let me know.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down