Hey there Gavin,

What I do with accessing these kind of scopes is I encapsulate the access
within my model. The best example of this is when accessing the current user
which is stored in session. Within my UserService I have two methods:
getCurrentUser() and setCurrentUser(). These two methods are the *only*
place where the session scope is accessed relating to the user object. I
like this method as it means that if I ever move from session to client I
can make the change in those methods and the entire application will
continue to run as it should without any other changes needed. It was also
really cool when I needed to change from storing the user object itself in
session to only storing the ID. Once again I only had to make the change in
one place.

So basically I recommend encapsulating scope access as much as possible
inside the model.

Cheers,
James.

---
James Allen
E: [email protected]
Blog: http://jamesallen.name
Twitter: @CFJamesAllen (Coldfusion / Web development)
Twitter: @jamesallenuk (General)

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Gavin Stewart
Sent: 21 July 2009 09:46
To: model-glue
Subject: [Model-Glue] Accessing session scope


Hello there,

I am a newby to model glue and was just wondering if is best practise
to access the session scope in controller.cfc or is there a way to
pass it in?

Cheers,
Gavin



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "model-glue" 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/model-glue?hl=en

For more about Model-Glue, check http://www.model-glue.com .
-~----------~----~----~----~------~----~------~--~---

Reply via email to