Hi everyone. I'd like to know if I'm doing wrong about performance/optimization. Let me explain:
Among my classes there is one (lets call it db_SqlServer) that is used to query the database using stored procedures. Every other class in the site that needs to access the database has an object of that db_SqlServer class. So when they query the database, the class db_SqlServer opens a connection, returns the results and closes the connection.
In short, I can have several db_SqlServer objects depending on how many other classes are running at that moment.
What should I do? Just one static db_SqlServer class? Use singleton to create just one instance of the class? I mean, is bad for performance to give every class its own db_SqlServer object or not? Is good for speed?
Many thanks in advance.
View Complete Post