Well at some point, some CFC has to interact with the session scope. It's
inevitable. Previously, I would have advocated creating a centralized
Session Facade to act as gatekeeper to anything in the shared scope. Sean
has since talked me out of that approach because it opens up all session
data to anything that uses the facade, which usually ends up with components
digging into session data that doesn't belong to them instead of going
through the "proper channels" and talking to other service objects.

In any event, you're right. The UserService would be talking to the session
scope directly to get and set the User object. This is a trade-off for
simplicity, since you could also create a UserSessionFacade or something
that would wrap up talking to the session scope for just that service, but
that seems like extra work for not much real benefit.

On Nov 3, 2007 9:07 PM, Mike Kear <[EMAIL PROTECTED]> wrote:

> Wait a minute!   How can the UserService return the session.cacheduserbean,
> if it's not passed into it?
>
> Once again, I thought it was a general rule-of-thumb that you never ask a
> CFC to access a shared scope.  That if a CFC needs to know something (in
> this case the session.userbean) it's passed in.
>
> Now if I'm using coldspring to instantiate all CFCs, how do I persuade
> ColdSpring to pass the session.userbean into the UserService?
>
> (I've gone round a full circle and I'm back where I started.)
>
> Cheers
> Mike Kear
> Windsor, NSW, Australia
> 0422 985 585
> Adobe Certified Advanced ColdFusion Developer
> AFP Webworks Pty Ltd
> http://afpwebworks.com
> Full Scale ColdFusion hosting from A$15/month
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Sean Corfield
> Sent: Sunday, 4 November 2007 7:42 AM
>
> [snip]
>
> Here's how I would handle the audit trail.
>
> First off, I'd have a userService that has methods: isLoggedIn() and
> getUser() that return true iff the user is logged in and the
> session-cached user bean respectively.
>
>
> [/snip]
>
>
>
>
>

Reply via email to