On Aug 31, 2011, at 8:58 AM, Chris Paveglio wrote: > But I am going to need the application to use the instance of the class from > when it's started, not make a new instance every time the script command is > given.
Well, that's not likely to happen, because that's not the way the framework works. > I have to connect to a database, and for performance, would rather not have > to create/open/use/close/destroy that connection every time it's called > (could be called a lot). I would rather have the connection created and ready > to use, and then just pass in my calls as needed, until the app quits (it's > going to run in the background). Fine, create it at startup, or on first need, and keep it around. Use a static variable, or some ivars & methods in your app controller class, or create a singleton class (although I don't recommend all the hoohah of enforcing singleton-ness, just create one at startup and keep it in a global variable). You don't have to, and probably shouldn't, stuff all your database connection management into a subclass of an AppleScript command anyway--probably better to abstract that into a class that deals with the database. -- Scott Ribe [email protected] http://www.elevated-dev.com/ (303) 722-0567 voice _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
