Hi René Thanks for the hint with the request-response cycle. We changed it so the ERXThreadStorage.takeValueForKey happens during the awake() of the session. I think there may be a more elegant solution to this, but it seems to work now.
Beni > On 16 Dec 2015, at 10:36, René Bock <[email protected]> wrote: > > Hi Beni, > > it looks like ERXThreadStorage.takeValueForKey (create session) happened not > in the same worker-thread than ERXThreadStorage.valueForKey. I only use > ERXThreadStorage to share data between objects during a request-response > cycle. > > You may extend EOEditingContext to keep a reference to an user object and > override session.defaultEditingContext to initialize the ec with the current > user. > > > regards > > René > > > > >> Am 16.12.2015 um 10:07 schrieb Benjamin Steiner <[email protected] >> <mailto:[email protected]>>: >> >> Hi list, >> >> In our application, we keep the business-logic with the EO-model in a >> separate framework. Because some of the enterprise objects are >> region-specific, we need to get access to the logged in user(or its region, >> respectively) with a static method. The problem is that the user is stored >> in the session, so we can’t access it from the business-framework. >> >> We tried to use ERXThreadStorage, but we only get NULL out of it when we try >> to get the region. Is there something we overlooked? >> Here’s the code we use to store and retrieve the region: >> >> (this happens in the constructor of the session, wenn the user logs in) >> ERXThreadStorage.takeValueForKey( region, >> ERXThreadStorageKeys.CURRENT_REGION ); >> >> (this happens on an EO in the business-framework) >> Region region = (Region)ERXThreadStorage.valueForKey( >> ERXThreadStorageKeys.CURRENT_REGION ); >> >> Thanks, >> Beni >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list ([email protected] >> <mailto:[email protected]>) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/webobjects-dev/bock%40salient.de >> <https://lists.apple.com/mailman/options/webobjects-dev/bock%40salient.de> >> >> This email sent to [email protected] <mailto:[email protected]>
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
