For this example, say I am working with a User object and I will have a DataGatewayFactory.cfc. On the page that needs the UserGateway, I would do something like the following:
DataGateway = createObject("component","DataGatewayFactory").init(dsn,username,password);
UserGateway = DataGateway.createDataGateway("User");
then be able to call UserGateway.listSomeUsers();
Inside the factory, the createDataGateway() method would first check to see if there is a UserGateway in the application scope. If there is, than return an instance of it. If there isn't an instance in the application scope, create it and return it.
Does that make sense? Is there anything goofy/dangerous about that?
Thanks...
~d
On 1/30/06, Matt Woodward <
[EMAIL PROTECTED]> wrote:
This is more or less what Mach-II does when you put a gateway inside
your listener--it will get loaded into the application scope when the
Mach-II app first loads. Should be fine (and make good sense
actually) to have these objects that you use over and over in the
application scope.
On 1/30/06, Dave Shuck <[EMAIL PROTECTED]> wrote:
> So as not to continually add the expense of re-instantiating gateway CFCs,
> is it safe to store an instance of a gateway CFC for each object in the
> application scope and just call gateway methods like
> application.UserGateway.listUsers()?. I was thinking about
> having an application initialization routine in my Mach-II application that
> will instantiate each gateway in the application scope onApplicationStart.
> Is there a better way of handling this?
>
> Thanks for any input.
>
> --
> ~Dave Shuck
> [EMAIL PROTECTED]
> www.daveshuck.com
> _______________________________________________
> Reply to DFWCFUG:
> [email protected]
> Subscribe/Unsubscribe:
> http://lists1.safesecureweb.com/mailman/listinfo/list
> List Archives:
> http://www.mail-archive.com/list%40list.dfwcfug.org/
> http://www.mail-archive.com/list%40dfwcfug.org/
> DFWCFUG Sponsors:
> www.HostMySite.com
> www.teksystems.com/
>
>
>
--
Matt Woodward
[EMAIL PROTECTED]
http://www.mattwoodward.com
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/
--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com
_______________________________________________ Reply to DFWCFUG: [email protected] Subscribe/Unsubscribe: http://lists1.safesecureweb.com/mailman/listinfo/list List Archives: http://www.mail-archive.com/list%40list.dfwcfug.org/ http://www.mail-archive.com/list%40dfwcfug.org/ DFWCFUG Sponsors: www.HostMySite.com www.teksystems.com/
