Hi all -
just today I wrote a small example that combines
* RIA-Services
* a framework of us that opens/closes NHib sessions (and more) for requests
* NHib 3.x
My problem, in a nutshell, is: When can I close the NHib session?
(My larger problem is probably: How do RIA Services work? ... but I dare not
ask this here).
Here are some details:
I found out (I think - this may be common knowledge) that RIA-Services is
stateful - it saves the IQueryable<> or at least the Provider in the web
server. Essentially, I wrote code like this:
[EnableClientAccess]
public class MyEntityService {
IQueryable<MyEntity> FindBla(...params...) {
using (var session = ...MySessionService...) {
return session.Query<MyEntity>().Where(...).....;
} // I closed the session here :-(
}
}
The client calls something like (writing off my head - not sure about all names
etc.):
var q = myEntityDomain.FindBlaQuery(...params..., Loaded);
private void Loaded(EntityQuery<MyEntity> result, ...) {
...show in GUI...;
}
And it seems that
* first, the client goes to the server to get the IQueryable<>;
* LATER, the client emits a SECOND call with some id of the IQueryable<> plus
some added operators (Take/Skip for paging, maybe an OrderBy); and now expects
the IQueryable<> to execute on its provider.
At this point, the session must be open (when I closed it as indicated above, I
got told in no uncertain words that the IQueryable would now not execute).
It seems then that if the user now e.g. pages through a list, the client does
more calls to the server for the *same* IQueryable<> (but with maybe different
Take/Skip additions) - so the session has to remain open all that time!?!
If this is so - when (and how) do I close it? (as an NHib session, it can grow
over all bounds ...)
If this is not so - what do I miss (if this sketchy description is enough to
answer this)?
Thanks for any enlightment, explanation, pointers or the like!
Harald M.
--
NEU: FreePhone - kostenlos mobil telefonieren und surfen!
Jetzt informieren: http://www.gmx.net/de/go/freephone
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.