Also if you don't want your listeners referencing the session scope, you could have a plugin handle that so to your listener they'd just be getting the dsn from the event object.
On Mon, Nov 7, 2011 at 1:09 PM, David D-V Tran <[email protected]>wrote: > I have a cms that uses site IDs - I have it check the sites table to pull > the correct site ID. Be sure to also place the check the OnRequest level > in the App file to make sure the domain matches up with the one in the db > table, if it matches up then it doesn't pull the trigger on invoking the > component for customer DSN on page load, only when it mismatches. > > On Mon, Nov 7, 2011 at 3:46 PM, Matthew Woodward <[email protected]>wrote: > >> Nothing wrong with your listeners referencing session variables, either >> directly or through a session facade. You want to avoid that in your >> service layer and further back, but there's nothing inappropriate about >> your listener knowing about the session scope IMO. >> >> >> On Mon, Nov 7, 2011 at 12:13 PM, RobM <[email protected]> wrote: >> >>> I think I understand. I was under the impression that the listener >>> should always pass in the DSN and not make the component reference it >>> directly. >>> >>> On Nov 7, 2:57 pm, Matthew Woodward <[email protected]> wrote: >>> > The point is you wouldn't initialize the component with that value, >>> you'd >>> > get it from the session as you need it. >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > On Mon, Nov 7, 2011 at 11:51 AM, RobM <[email protected]> wrote: >>> > > While the customer dsn is loaded at login, if i don't change the >>> > > cached cfc, it will use whatever value was passed in when the init >>> > > function was called. >>> > >>> > > If i were to call this in the top of the listener... >>> > >>> > > <cfset variables.my_obj = CreateObject('Component', >>> > > 'path.component').init(session.customer_dsn)> >>> > >>> > > it would remain whatever session.customer_dsn was at when the >>> > > framework was loaded. It would mean forcing Mach-II to reload every >>> > > time someone logged in. >>> > >>> > > On Nov 7, 2:41 pm, David D-V Tran <[email protected]> wrote: >>> > > > why don't you do a check instead for the customer ID and load the >>> DSN >>> > > upon >>> > > > session load in a session variable? >>> > >>> > > > On Mon, Nov 7, 2011 at 2:37 PM, RobM <[email protected]> wrote: >>> > > > > Because each of our customer's data is stored on separate DSNs, >>> and >>> > > > > the if the DSN string is passed into an object on load as >>> described in >>> > > > > the, it stays there until Mach-II is reloaded. This can cause >>> customer >>> > > > > 1 to read data from customer 2 if Mach-II is not reloaded between >>> > > > > customer 1's log out and customer 2's login. My solution was to >>> > > > > initialize the referenced objects before the function call, so >>> that >>> > > > > they would collect the new dsn value from a new login instead of >>> the >>> > > > > cached dsn value. >>> > >>> > > > > On Nov 7, 2:16 pm, Matthew Woodward <[email protected]> >>> wrote: >>> > > > > > On Mon, Nov 7, 2011 at 11:11 AM, RobM <[email protected]> >>> wrote: >>> > > > > > > Hello, >>> > > > > > > I'm working on making our existing Mach-ii application >>> initialize >>> > > the >>> > > > > > > objects it needs when it calls a function in the listener as >>> > > opposed >>> > > > > > > to initializing them on load. >>> > >>> > > > > > Why? >>> > > > > > -- >>> > > > > > Matthew Woodward >>> > > > > > [email protected]http://blog.mattwoodward.com >>> > > > > > identi.ca / Twitter: @mpwoodward >>> > >>> > > > > > Please do not send me proprietary file formats such as Word, >>> > > PowerPoint, >>> > > > > > etc. as attachments. >>> > > > >http://www.gnu.org/philosophy/no-word-attachments.html >>> > >>> > > > > -- >>> > > > > To post to this group, send email to >>> > > > > [email protected] >>> > > > > For more options and to unsubscribe, visit this group at >>> > > > >http://groups.google.com/group/mach-ii-for-coldfusion?hl=en >>> > >>> > > > > SVN:http://svn.mach-ii.com/machii/ >>> > > > > Wiki / Documentation / Tickets:http://trac.mach-ii.com/machii/ >>> > >>> > > -- >>> > > To post to this group, send email to >>> > > [email protected] >>> > > For more options and to unsubscribe, visit this group at >>> > >http://groups.google.com/group/mach-ii-for-coldfusion?hl=en >>> > >>> > > SVN:http://svn.mach-ii.com/machii/ >>> > > Wiki / Documentation / Tickets:http://trac.mach-ii.com/machii/ >>> > >>> > -- >>> > Matthew Woodward >>> > [email protected]http://blog.mattwoodward.com >>> > identi.ca / Twitter: @mpwoodward >>> > >>> > Please do not send me proprietary file formats such as Word, >>> PowerPoint, >>> > etc. as attachments. >>> http://www.gnu.org/philosophy/no-word-attachments.html >>> >>> -- >>> To post to this group, send email to >>> [email protected] >>> For more options and to unsubscribe, visit this group at >>> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en >>> >>> SVN: http://svn.mach-ii.com/machii/ >>> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ >>> >> >> >> >> -- >> Matthew Woodward >> [email protected] >> >> http://blog.mattwoodward.com >> identi.ca / Twitter: @mpwoodward >> >> Please do not send me proprietary file formats such as Word, PowerPoint, >> etc. as attachments. >> http://www.gnu.org/philosophy/no-word-attachments.html >> >> -- >> To post to this group, send email to >> [email protected] >> For more options and to unsubscribe, visit this group at >> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en >> >> SVN: http://svn.mach-ii.com/machii/ >> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ >> > > > > -- > To post to this group, send email to > [email protected] > For more options and to unsubscribe, visit this group at > http://groups.google.com/group/mach-ii-for-coldfusion?hl=en > > SVN: http://svn.mach-ii.com/machii/ > Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ > -- Matthew Woodward [email protected] http://blog.mattwoodward.com identi.ca / Twitter: @mpwoodward Please do not send me proprietary file formats such as Word, PowerPoint, etc. as attachments. http://www.gnu.org/philosophy/no-word-attachments.html -- To post to this group, send email to [email protected] For more options and to unsubscribe, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
