Last post Dec 08, 2015 10:12 PM by Lannie
Dec 08, 2015 02:17 PM|nvielbig|LINK
I have a helper class in an external library which takes in an OracleConnection and returns whether it is a Production, User or Test database.
Basically I do
OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString);
string environmentName = ApplicationEnvironment.GetEnvironment(conn).ToString();
Since I am never opening the connection, can anyone confirm that this is not something to be concerned about?
Dec 08, 2015 02:31 PM|PatriceSc|LINK
Shouldn't but as a best practice just dispose the connection once you are done with it as for all disposable classes. Not sure what you are doing but if this is to check its connection string then you likely don't need anyway to create a connection.
Dec 08, 2015 10:12 PM|Lannie|LINK
depends on operational tempo and number of users.
small office app with user requesting a select here, insert there, update this,
and open and close not a problem
ramp that up to thousands of users coming at you with all kinds of requests
then staying open and adding things like connection pooling become more important