We have a client-server architecture with WCF
on the server side. All WCF
s are per-call; basically each WCF
method is a transaction script. When a WCF
-method gets called, client passes some authentication information (let's say for simplicity, user ID). This ID (along with some other user-related info) is than needed everywhere in the logic layer to check permissions for pulling some objects from DB, to answer in appropriate language and so on.
Currently we packed all this info into a "RequestBag"-object somewhere centrally when request arrives and passed it along to classes in logic. This however results that it's passed pretty much everywhere.
Is there a better way? Basically what I would like to do is call some static method and say GetCurrentUserState()
, which would give me data relevant for the context of current WCF
call. But how to do this? Thread ID is not an option, for some threads can be started to do some tasks. MSDN says
"There is no general data store associated with a WCF session"
. Does this mean that passing my object everywhere IS actually a way to do this?