todonnell69
Member
- Joined
- Jun 8, 2005
- Messages
- 15
- Programming Experience
- 5-10
Hey all,
If I am instantiating an object from code, and that object will be populated by(or saved to) a database, where should the code reside that actually makes the connection to and reads from the DB? Do best practices dictate the connection is made in the code that calls the object or in the class itself? If it goes in the class itself, I guess I would need to pass in the connection info which would not be a problem, but is this how it's commonly done?
Thanks in advance...
Tom
If I am instantiating an object from code, and that object will be populated by(or saved to) a database, where should the code reside that actually makes the connection to and reads from the DB? Do best practices dictate the connection is made in the code that calls the object or in the class itself? If it goes in the class itself, I guess I would need to pass in the connection info which would not be a problem, but is this how it's commonly done?
Thanks in advance...
Tom