If you have a fully encapsulated CFC it should be unaware of it's
environment in any way.  Since the session scope is part of the CF
environment, CFCs shouldn't know about it.  Generally the better route is to
put the entire CFC in the session scope, and have the CFC only manupulate
instance variable (which are also in the session scope, because the whole
CFC is).  That way the CFC doesn't need to know about the various CF scopes.
This same thing applies to the application and server scopes as well.

Now, not every CFC is fully encapsulated.  If you have a CFC who's task is
to manage authentication, it's almost required to set session (or client)
variables.  The difference is that this CFC is setting the session variables
for OTHER CODE to make use of (possibly CFCs, possibly not).  It's not
setting them for IT'S INTERNAL USE.

Obviously that's a gross oversimplification of the whole situation, but
hopefully helps.

Cheers,
barneyb

> -----Original Message-----
> From: Merritt Chapman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 11, 2004 8:36 AM
> To: CF-Talk
> Subject: Re:Session Variables in CFCs
>
> Nathan,
>
> I'm running CFMX 6.1 Enterprise.  Are you saying that
> declaring session variables within CFCs is bad architecture?  
> If so, please explain.  Also, for my own use, could you give
> me an example of a session variable declaration that should
> work within a CFC?
>
> Thanks again!
> MC
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to