You are not logged in.
sorry for my misunderstanding but I couldn't figure it by myself .
I want to retrieve the current thread user details in the context of sample 14 TServiceCalculator.add method (server side)
SessionGetUser is protected method and not accessible and where do I take from the aSessionID parameter .
Offline
You are right.
TSQLRestServer.SessionGetUser method is now made public (e.g. when calling CurrentServiceContext.Factory.RestServer.SessionGetUser).
See http://synopse.info/fossil/info/7097ca9b63
Thanks for the feedback.
Offline
Thanks,
and aSessionID is TSQLRestClientURI(ServiceRunningContext.Factory.RestServer).SessionID ?
Last edited by nirnir (2013-11-15 16:05:29)
Offline
No, here RestServer is a TSQLRestServer, not a TSQLRestClientURI!!!
Never typecast like this in your code.
You should better write instead:
(ServiceRunningContext.Factory.RestServer as TSQLRestClientURI).SessionID
you would have an explicit casting error at run-time, whereas your TSQLRestClientURI() will force the casting with no check, so would lead into random issues.
In your case, you can use ServiceContext.Request.Session - as stated by the documentation of ServiceContext.Request.
And in fact, you have a reference to the server instance at ServiceContext.Request.Server, which should be = to ServiceRunningContext.Factory.RestServer.
Offline