That is, in fact, what I am doing. I have a AuthenticatedUser CFC that contains all of the information about the user that is signed in. Now, for example, say I want to run a query that gets all of the timebills for that user, I would "SELECT foo FROM bar WHERE UserID = #session.myAuthenticatedUser.getUserID()#" I would prefer doing that without having to put a session lock around or in my query, which is why I wanted to copy the object down into request. Make sense, or am I going about this the wrong way?
> -----Original Message----- > From: Sean Corfield [mailto:[EMAIL PROTECTED] > Sent: Monday, October 29, 2007 4:00 PM > To: CF-Talk > Subject: Re: Copying a CFC Persisted in Session Scope > > On 10/29/07, Rich <[EMAIL PROTECTED]> wrote: > > I would suggest that you create a Session Facade and then have all > > your objects reference the façade. It is generally a bad > idea to have > > an object reference an external scope (session, request, etc.), and > > this technique hides the implementation from your business objects. > > And having references to sessionFacade.getFoo() everywhere is > somehow better than having references to session.foo? > > Having a giant kitchen sink session facade CFC is not a good > idea and is not encapsulation. That sort of session facade is > not a coherent object and having "sessionfacade" everywhere > means you have not encapsulated use of session scope at all - > you've just required that people call functions to get at data. > > The better solution is to consider what data you have in > session scope in the first place and encapsulate each piece > of data in an object that relates to that data. You might > have a user object in session scope - encapsulate that > knowledge in a userService (singleton). That way you've > encapsulated how the user is stored - none of your > application code knows about session scope (or > sessionFacade!). You ask the service to perform operations on > the current user and it knows how to do that. It can even > give you the user object if you want to operate on it > directly. That means your application code is only dependent > on a fully encapsulated service. It also means that you can > change how the user object is stored independent of any other > data in session scope (because that other data is > encapsulated elsewhere) and nothing in your application needs > to change. > > Sorry, but this weird obsession with sessionFacade CFCs drives me nuts > - it's completely misguided and a very procedural way of thinking. > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Enterprise web applications, build robust, secure scalable apps today - Try it now ColdFusion Today ColdFusion 8 beta - Build next generation apps Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292279 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

